Zope Content Management Framework (CMF)

GenericSetup: Fails to export a non-ascii line property

Reported by Jens Quade on 2008-03-14
4
Affects Status Importance Assigned to Milestone
Zope CMF
Undecided
Jens Vagelpohl

Bug Description

Products.GenericSetup.utils contains an error, ignoring the immutability of strings.

--- Products/GenericSetup/utils.py.orig 2008-03-07 14:59:52.000000000 +0100
+++ Products/GenericSetup/utils.py 2008-03-15 00:01:15.000000000 +0100
@@ -660,7 +660,7 @@
             if isinstance(prop, (tuple, list)):
                 for value in prop:
                     if isinstance(value, str):
- value.decode(self._encoding)
+ value = value.decode(self._encoding)
                     child = self._doc.createElement('element')
                     child.setAttribute('value', value)
                     node.appendChild(child)

The following patch modifies test_utils.py to check for non-ascii property lines:

--- Products/GenericSetup/tests/test_utils.py.orig 2008-01-06 01:05:47.000000000 +0100
+++ Products/GenericSetup/tests/test_utils.py 2008-03-15 00:19:01.000000000 +0100
@@ -47,7 +47,7 @@
 </dummy>
 """

-_NORMAL_PROPERTY_EXPORT = """\
+_NORMAL_PROPERTY_EXPORT = u"""\
 <?xml version="1.0"?>
 <dummy>
  <property name="foo_boolean" type="boolean">True</property>
@@ -57,6 +57,7 @@
  <property name="foo_lines" type="lines">
   <element value="Foo"/>
   <element value="Lines"/>
+ <element value="\xfcbrigens"/>
  </property>
  <property name="foo_long" type="long">1</property>
  <property name="foo_string" type="string">Foo String</property>
@@ -78,9 +79,9 @@
  <property name="foo_float_nodel">3.1415</property>
  <property name="foo_boolean_nodel">True</property>
 </dummy>
-"""
+""".encode('utf-8')

-_FIXED_PROPERTY_EXPORT = """\
+_FIXED_PROPERTY_EXPORT = u"""\
 <?xml version="1.0"?>
 <dummy>
  <property name="foo_boolean">True</property>
@@ -90,6 +91,7 @@
  <property name="foo_lines">
   <element value="Foo"/>
   <element value="Lines"/>
+ <element value="\xfcbrigens"/>
  </property>
  <property name="foo_long">1</property>
  <property name="foo_string">Foo String</property>
@@ -109,7 +111,7 @@
  <property name="foo_float_nodel">3.1415</property>
  <property name="foo_boolean_nodel">True</property>
 </dummy>
-"""
+""".encode('utf-8')

 _SPECIAL_IMPORT = """\
 <?xml version="1.0"?>
@@ -261,7 +263,7 @@
         obj._updateProperty('foo_date', '2000/01/01')
         obj._updateProperty('foo_float', '1.1')
         obj._updateProperty('foo_int', '1')
- obj._updateProperty('foo_lines', 'Foo\nLines')
+ obj._updateProperty('foo_lines', u'Foo\nLines\n\xfcbrigens'.encode('utf-8'))
         obj._updateProperty('foo_long', '1')
         obj._updateProperty('foo_string', 'Foo String')
         obj._updateProperty('foo_text', 'Foo\nText')

Andreas Jung (ajung) wrote :

Please post this to the CMF Bugtracker on Launchpad.

Changed in zope2:
status: New → Invalid

On 15 Mar 2008, at 00:50 , Andreas Jung wrote:
> Please post this to the CMF Bugtracker on Launchpad.
>
> ** Changed in: zope2
> Status: New => Invalid

No need to reject and repost a bug on launchpad: you can simply change
the project that a bug belongs to. (Click on the drop down arrow next
to the Affects/Zope 2 column and change the project to CMF or whatever)

Andreas Jung (ajung) on 2008-03-15
Changed in zope2:
status: Invalid → New
Jens Vagelpohl (dataflake) wrote :
Changed in zope-cmf:
assignee: nobody → jens-dataflake
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers