From fac868db8248ff80d64458a43c7d46b49eda0c64 Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Fri, 11 Jan 2008 13:29:22 +0000 Subject: [PATCH] patch again for pickling reduce type object. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18663 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/patches/ppml.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/product/ERP5Type/patches/ppml.py b/product/ERP5Type/patches/ppml.py index 09f2b7277e..bdeab926bc 100644 --- a/product/ERP5Type/patches/ppml.py +++ b/product/ERP5Type/patches/ppml.py @@ -662,6 +662,28 @@ def save_unicode(self, tag, data): 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): -- 2.30.9