Commit b7a8d1d8 authored by Nicolas Delaby's avatar Nicolas Delaby

- during unmarshalling create classes of real input objects (if such are

   found while unmarshalling)
parent 9ed0a1a6
from setuptools import setup, find_packages from setuptools import setup, find_packages
import sys, os import sys, os
version = '0.9.1' version = '0.9.2'
setup(name='xml_marshaller', setup(name='xml_marshaller',
version=version, version=version,
......
...@@ -9,7 +9,7 @@ Patched by Nicolas Delaby nicolas@nexedi.com to support namespaces ...@@ -9,7 +9,7 @@ Patched by Nicolas Delaby nicolas@nexedi.com to support namespaces
# same name, with four functions: # same name, with four functions:
# dump(value, file), load(file) # dump(value, file), load(file)
# dumps(value), loads(string) # dumps(value), loads(string)
from types import ClassType from types import ClassType, TypeType
import sys import sys
from xml.sax import make_parser from xml.sax import make_parser
from xml.sax.saxutils import escape, unescape from xml.sax.saxutils import escape, unescape
...@@ -527,9 +527,9 @@ class Unmarshaller(ElementTreeContentHandler): ...@@ -527,9 +527,9 @@ class Unmarshaller(ElementTreeContentHandler):
value, module, classname, initargs, kw = self.data_stack[-5:] value, module, classname, initargs, kw = self.data_stack[-5:]
klass = self.find_class(module, classname) klass = self.find_class(module, classname)
instantiated = 0 instantiated = 0
if (not initargs and isinstance(klass, ClassType) and if (not initargs and (isinstance(klass, (ClassType, TypeType))) and
not hasattr(klass, '__getinitargs__')): not hasattr(klass, '__getinitargs__')):
value.__class__ = klass value = klass()
instantiated = 1 instantiated = 1
if not instantiated: if not instantiated:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment