def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
python类ensure_new_type()的实例源码
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __dump(self, value, write):
try:
f = self.dispatch[type(ensure_new_type(value))]
except KeyError:
# check if this object can be marshalled as a structure
if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
# (e.g. a string sub-class)
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
f = self.dispatch["_arbitrary_instance"]
f(self, value, write)
def __repr__(self):
return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
ensure_new_type(self.faultString))
# --------------------------------------------------------------------
# Special values
##
# Backwards compatibility
def __repr__(self):
return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
def dump_double(self, value, write):
write("<value><double>")
write(repr(ensure_new_type(value)))
write("</double></value>\n")
def __repr__(self):
return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
ensure_new_type(self.faultString))
# --------------------------------------------------------------------
# Special values
##
# Backwards compatibility
def __repr__(self):
return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
def dump_double(self, value, write):
write("<value><double>")
write(repr(ensure_new_type(value)))
write("</double></value>\n")
def __repr__(self):
return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
ensure_new_type(self.faultString))
# --------------------------------------------------------------------
# Special values
##
# Backwards compatibility
def __repr__(self):
return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
def dump_double(self, value, write):
write("<value><double>")
write(repr(ensure_new_type(value)))
write("</double></value>\n")
def __repr__(self):
return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
ensure_new_type(self.faultString))
# --------------------------------------------------------------------
# Special values
##
# Backwards compatibility
def __repr__(self):
return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
def dump_double(self, value, write):
write("<value><double>")
write(repr(ensure_new_type(value)))
write("</double></value>\n")
def __repr__(self):
return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
ensure_new_type(self.faultString))
# --------------------------------------------------------------------
# Special values
##
# Backwards compatibility
def __repr__(self):
return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
def dump_double(self, value, write):
write("<value><double>")
write(repr(ensure_new_type(value)))
write("</double></value>\n")
def __repr__(self):
return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
ensure_new_type(self.faultString))
# --------------------------------------------------------------------
# Special values
##
# Backwards compatibility
def __repr__(self):
return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
def dump_double(self, value, write):
write("<value><double>")
write(repr(ensure_new_type(value)))
write("</double></value>\n")
def __repr__(self):
return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
ensure_new_type(self.faultString))
# --------------------------------------------------------------------
# Special values
##
# Backwards compatibility