[Erp5-report] r39636 nicolas - /erp5/trunk/utils/xml_marshaller/src/xml_marshaller/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 28 18:58:57 CEST 2010
Author: nicolas
Date: Thu Oct 28 18:58:53 2010
New Revision: 39636
URL: http://svn.erp5.org?rev=39636&view=rev
Log:
Return always string as str and unicode as unicode.
codec used for encoding is utf-8.
Modified:
erp5/trunk/utils/xml_marshaller/src/xml_marshaller/xml_marshaller.py
Modified: erp5/trunk/utils/xml_marshaller/src/xml_marshaller/xml_marshaller.py
URL: http://svn.erp5.org/erp5/trunk/utils/xml_marshaller/src/xml_marshaller/xml_marshaller.py?rev=39636&r1=39635&r2=39636&view=diff
==============================================================================
--- erp5/trunk/utils/xml_marshaller/src/xml_marshaller/xml_marshaller.py [utf8] (original)
+++ erp5/trunk/utils/xml_marshaller/src/xml_marshaller/xml_marshaller.py [utf8] Thu Oct 28 18:58:53 2010
@@ -440,14 +440,18 @@ class Unmarshaller(ElementTreeContentHan
def um_end_string(self, name):
ds = self.data_stack
- # might need to convert unicode string to byte string
- ds[-1] = unescape(''.join(ds[-1]))
+ value = unescape(''.join(ds[-1]))
+ if isinstance(value, unicode):
+ value = value.encode('utf-8')
+ ds[-1] = value
self.accumulating_chars = 0
def um_end_unicode(self, name):
ds = self.data_stack
- # might need to convert unicode string to byte string
- ds[-1] = unescape(''.join(ds[-1]))
+ value = unescape(''.join(ds[-1]))
+ if not isinstance(value, unicode):
+ value = value.decode('utf-8')
+ ds[-1] = value
self.accumulating_chars = 0
def um_end_int(self, name):
More information about the Erp5-report
mailing list