[Erp5-report] r36852 nicolas - in /erp5/trunk/utils/xml_marshaller: ./ xml_marshaller/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jul 5 11:01:54 CEST 2010


Author: nicolas
Date: Mon Jul  5 11:01:53 2010
New Revision: 36852

URL: http://svn.erp5.org?rev=36852&view=rev
Log:
 - during unmarshalling create classes of real input objects (if such are
   found while unmarshalling)

Modified:
    erp5/trunk/utils/xml_marshaller/setup.py
    erp5/trunk/utils/xml_marshaller/xml_marshaller/xml_marshaller.py

Modified: erp5/trunk/utils/xml_marshaller/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/xml_marshaller/setup.py?rev=36852&r1=36851&r2=36852&view=diff
==============================================================================
--- erp5/trunk/utils/xml_marshaller/setup.py [utf8] (original)
+++ erp5/trunk/utils/xml_marshaller/setup.py [utf8] Mon Jul  5 11:01:53 2010
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import sys, os
 
-version = '0.9.1'
+version = '0.9.2'
 
 setup(name='xml_marshaller',
       version=version,

Modified: erp5/trunk/utils/xml_marshaller/xml_marshaller/xml_marshaller.py
URL: http://svn.erp5.org/erp5/trunk/utils/xml_marshaller/xml_marshaller/xml_marshaller.py?rev=36852&r1=36851&r2=36852&view=diff
==============================================================================
--- erp5/trunk/utils/xml_marshaller/xml_marshaller/xml_marshaller.py [utf8] (original)
+++ erp5/trunk/utils/xml_marshaller/xml_marshaller/xml_marshaller.py [utf8] Mon Jul  5 11:01:53 2010
@@ -9,7 +9,7 @@ Patched by Nicolas Delaby nicolas at nexedi
 # same name, with four functions:
 #   dump(value, file), load(file)
 #   dumps(value), loads(string)
-from types import ClassType
+from types import ClassType, TypeType
 import sys
 from xml.sax import make_parser
 from xml.sax.saxutils import escape, unescape
@@ -527,9 +527,9 @@ class Unmarshaller(ElementTreeContentHan
     value, module, classname, initargs, kw = self.data_stack[-5:]
     klass = self.find_class(module, classname)
     instantiated = 0
-    if (not initargs and isinstance(klass, ClassType) and
+    if (not initargs and (isinstance(klass, (ClassType, TypeType))) and
       not hasattr(klass, '__getinitargs__')):
-      value.__class__ = klass
+      value = klass()
       instantiated = 1
 
     if not instantiated:




More information about the Erp5-report mailing list