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

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jan 11 14:29:23 CET 2008


Author: yusei
Date: Fri Jan 11 14:29:22 2008
New Revision: 18663

URL: http://svn.erp5.org?rev=18663&view=rev
Log:
patch again for pickling reduce type object.

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=18663&r1=18662&r2=18663&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/ppml.py (original)
+++ erp5/trunk/products/ERP5Type/patches/ppml.py Fri Jan 11 14:29:22 2008
@@ -662,6 +662,28 @@
 
 ppml.save_unicode = save_unicode
 
+def save_object(self, tag, data):
+    if len(data)==5:
+        #OBJECT
+        v='('+data[2]
+        x=data[3][1:]
+        stop=string.rfind(x,'t')  # This seems
+        if stop>=0: x=x[:stop]    # wrong!
+        v=save_put(self, v+x+'o', data[1])
+        v=v+data[4]+'b' # state
+        return v
+    else:
+        #REDUCE
+        #data does not contain state.(See Object.__setstate__ definition)
+        #So, we can assume that this is a reduce. (Yusei)
+        v='('+data[2]
+        v=save_put(self, data[2]+data[3], data[1])
+        v=v+'R'
+        return v
+
+ppml.save_object = save_object
+
+
 class xmlPickler(NoBlanks, xyap):
     # XXX fix a bug in xyap.
     def unknown_endtag(self, tag):




More information about the Erp5-report mailing list