[Erp5-report] r17073 - /erp5/trunk/products/ERP5Type/patches/ppml.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Oct 22 03:29:25 CEST 2007


Author: yo
Date: Mon Oct 22 03:29:25 2007
New Revision: 17073

URL: http://svn.erp5.org?rev=17073&view=rev
Log:
Make sure that XML data is str rather than unicode.

Modified:
    erp5/trunk/products/ERP5Type/patches/ppml.py

Modified: erp5/trunk/products/ERP5Type/patches/ppml.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/ppml.py?rev=17073&r1=17072&r2=17073&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/ppml.py (original)
+++ erp5/trunk/products/ERP5Type/patches/ppml.py Mon Oct 22 03:29:25 2007
@@ -249,7 +249,10 @@
 class NoBlanks:
 
     def handle_data(self, data):
-        if data.strip(): self.append(data)
+        if data.strip():
+            if isinstance(data, unicode):
+                data = data.encode('raw_unicode_escape')
+            self.append(data)
 
 ppml.NoBlanks = NoBlanks
 
@@ -660,6 +663,18 @@
 ppml.save_unicode = save_unicode
 
 class xmlPickler(NoBlanks, xyap):
+    # XXX fix a bug in xyap.
+    def unknown_endtag(self, tag):
+        _stack = self._stack
+        top = _stack.pop()
+        append = self.append = _stack[-1].append
+        end = self.end_handlers
+        if tag in end:
+            top = end[tag](self, tag, top)
+        if isinstance(top, unicode):
+            top = top.encode('raw_unicode_escape')
+        append(top)
+
     start_handlers={
         'pickle': lambda self, tag, attrs: [tag, attrs],
         }




More information about the Erp5-report mailing list