|
|
@@ -100,7 +100,7 @@ class SOAPBuilder: |
|
|
|
self.noroot = noroot |
|
|
|
|
|
|
|
def build(self): |
|
|
|
if Config.debug: print "In build." |
|
|
|
if self.config.debug: print "In build." |
|
|
|
ns_map = {} |
|
|
|
|
|
|
|
# Cache whether typing is on or not |
|
|
@@ -197,7 +197,7 @@ class SOAPBuilder: |
|
|
|
return ''.join(self.out) |
|
|
|
|
|
|
|
def gentag(self): |
|
|
|
if Config.debug: print "In gentag." |
|
|
|
if self.config.debug: print "In gentag." |
|
|
|
self.tcounter += 1 |
|
|
|
return "v%d" % self.tcounter |
|
|
|
|
|
|
@@ -279,7 +279,7 @@ class SOAPBuilder: |
|
|
|
# dumpers |
|
|
|
|
|
|
|
def dump(self, obj, tag = None, typed = 1, ns_map = {}): |
|
|
|
if Config.debug: print "In dump.", "obj=", obj |
|
|
|
if self.config.debug: print "In dump.", "obj=", obj |
|
|
|
ns_map = ns_map.copy() |
|
|
|
self.depth += 1 |
|
|
|
|
|
|
@@ -293,7 +293,7 @@ class SOAPBuilder: |
|
|
|
def dumper(self, nsURI, obj_type, obj, tag, typed = 1, ns_map = {}, |
|
|
|
rootattr = '', id = '', |
|
|
|
xml = '<%(tag)s%(type)s%(id)s%(attrs)s%(root)s>%(data)s</%(tag)s>\n'): |
|
|
|
if Config.debug: print "In dumper." |
|
|
|
if self.config.debug: print "In dumper." |
|
|
|
|
|
|
|
if nsURI == None: |
|
|
|
nsURI = self.config.typesNamespaceURI |
|
|
@@ -324,12 +324,12 @@ class SOAPBuilder: |
|
|
|
"id": id, "attrs": a} |
|
|
|
|
|
|
|
def dump_float(self, obj, tag, typed = 1, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_float." |
|
|
|
if self.config.debug: print "In dump_float." |
|
|
|
tag = tag or self.gentag() |
|
|
|
|
|
|
|
tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
|
|
|
|
|
|
|
if Config.strict_range: |
|
|
|
if self.config.strict_range: |
|
|
|
doubleType(obj) |
|
|
|
|
|
|
|
if PosInf == obj: |
|
|
@@ -346,7 +346,7 @@ class SOAPBuilder: |
|
|
|
None, "double", obj, tag, typed, ns_map, self.genroot(ns_map))) |
|
|
|
|
|
|
|
def dump_int(self, obj, tag, typed = 1, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_int." |
|
|
|
if self.config.debug: print "In dump_int." |
|
|
|
|
|
|
|
# fix error "Bad types (class java.math.BigInteger -> class java.lang.Integer)" |
|
|
|
if isinstance(obj, LongType): |
|
|
@@ -358,12 +358,12 @@ class SOAPBuilder: |
|
|
|
ns_map, self.genroot(ns_map))) |
|
|
|
|
|
|
|
def dump_bool(self, obj, tag, typed = 1, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_bool." |
|
|
|
if self.config.debug: print "In dump_bool." |
|
|
|
self.out.append(self.dumper(None, 'boolean', obj, tag, typed, |
|
|
|
ns_map, self.genroot(ns_map))) |
|
|
|
|
|
|
|
def dump_string(self, obj, tag, typed = 0, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_string." |
|
|
|
if self.config.debug: print "In dump_string." |
|
|
|
tag = tag or self.gentag() |
|
|
|
tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
|
|
|
|
|
|
@@ -381,7 +381,7 @@ class SOAPBuilder: |
|
|
|
dump_unicode = dump_string |
|
|
|
|
|
|
|
def dump_None(self, obj, tag, typed = 0, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_None." |
|
|
|
if self.config.debug: print "In dump_None." |
|
|
|
tag = tag or self.gentag() |
|
|
|
tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
|
|
|
ns = self.genns(ns_map, self.config.schemaNamespaceURI)[0] |
|
|
@@ -392,7 +392,7 @@ class SOAPBuilder: |
|
|
|
dump_NoneType = dump_None # For Python 2.2+ |
|
|
|
|
|
|
|
def dump_list(self, obj, tag, typed = 1, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_list.", "obj=", obj |
|
|
|
if self.config.debug: print "In dump_list.", "obj=", obj |
|
|
|
tag = tag or self.gentag() |
|
|
|
tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
|
|
|
|
|
|
@@ -512,7 +512,7 @@ class SOAPBuilder: |
|
|
|
dump_tuple = dump_list |
|
|
|
|
|
|
|
def dump_map(self, obj, tag, typed = 1, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_map.", "obj=", obj |
|
|
|
if self.config.debug: print "In dump_map.", "obj=", obj |
|
|
|
tag = tag or self.gentag() |
|
|
|
tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
|
|
|
|
|
|
@@ -566,7 +566,7 @@ class SOAPBuilder: |
|
|
|
self.out.append("</%sFault>\n" % vns) |
|
|
|
|
|
|
|
def dump_dictionary(self, obj, tag, typed = 1, ns_map = {}): |
|
|
|
if Config.debug: print "In dump_dictionary." |
|
|
|
if self.config.debug: print "In dump_dictionary." |
|
|
|
tag = tag or self.gentag() |
|
|
|
tag = toXMLname(tag) # convert from SOAP 1.2 XML name encoding |
|
|
|
|
|
|
@@ -596,7 +596,13 @@ class SOAPBuilder: |
|
|
|
else: |
|
|
|
tag = self.gentag() |
|
|
|
|
|
|
|
# watch out for order! |
|
|
|
# Apply additional types, override built-in types |
|
|
|
for dtype, func in self.config.dumpmap: |
|
|
|
if isinstance(obj, dtype): |
|
|
|
func(self, obj, tag, typed, ns_map) |
|
|
|
return |
|
|
|
|
|
|
|
# watch out for order! |
|
|
|
dumpmap = ( |
|
|
|
(Exception, self.dump_exception), |
|
|
|
(mapType, self.dump_map), |
|
|
|