[CMF-checkins] SVN: CMF/trunk/GenericSetup/ - fixed type of
imported properties (PropertyManager uses utf-8 by default)
Yvo Schubbe
y.2005- at wcm-solutions.de
Mon Nov 7 13:19:31 EST 2005
Log message for revision 39962:
- fixed type of imported properties (PropertyManager uses utf-8 by default)
Changed:
U CMF/trunk/GenericSetup/tests/test_utils.py
U CMF/trunk/GenericSetup/utils.py
-=-
Modified: CMF/trunk/GenericSetup/tests/test_utils.py
===================================================================
--- CMF/trunk/GenericSetup/tests/test_utils.py 2005-11-07 17:49:51 UTC (rev 39961)
+++ CMF/trunk/GenericSetup/tests/test_utils.py 2005-11-07 18:19:30 UTC (rev 39962)
@@ -246,6 +246,10 @@
def test__initProperties_normal(self):
node = parseString(_NORMAL_PROPERTY_EXPORT).documentElement
self.helpers._initProperties(node, PURGE)
+ self.assertEqual(type(self.helpers.context.foo_int), int)
+ self.assertEqual(type(self.helpers.context.foo_string), str)
+ self.assertEqual(type(self.helpers.context.foo_tokens), tuple)
+ self.assertEqual(type(self.helpers.context.foo_tokens[0]), str)
doc = self.helpers._doc = PrettyDocument()
node = doc.createElement('dummy')
Modified: CMF/trunk/GenericSetup/utils.py
===================================================================
--- CMF/trunk/GenericSetup/utils.py 2005-11-07 17:49:51 UTC (rev 39961)
+++ CMF/trunk/GenericSetup/utils.py 2005-11-07 18:19:30 UTC (rev 39962)
@@ -576,7 +576,7 @@
elements = []
for sub in child.childNodes:
if sub.nodeName == 'element':
- elements.append(sub.getAttribute('value'))
+ elements.append(sub.getAttribute('value').encode('utf-8'))
if elements or prop_map.get('type') == 'multiple selection':
prop_value = tuple(elements) or ()
@@ -585,6 +585,6 @@
else:
# if we pass a *string* to _updateProperty, all other values
# are converted to the right type
- prop_value = self._getNodeText(child)
+ prop_value = self._getNodeText(child).encode('utf-8')
obj._updateProperty(prop_id, prop_value)
More information about the CMF-checkins
mailing list