Amaury Forgeot d'Arc <[email protected]> added the comment:
It's easy enough to subclass the Transport type and add custom types to the
dispatcher object, see the script below.
Attila, Bhargav, is this solution acceptable to you?
from xmlrpclib import Transport, ServerProxy
class MyTransport(Transport):
def getparser(self):
parser, unmarshaller = Transport.getparser(self)
# Get the class attribute, clone it
dispatch = unmarshaller.dispatch.copy()
# and store it on the instance
unmarshaller.dispatch = dispatch
# Now we can add custom types
dispatch["ex:i8"] = dispatch["int"]
return parser, unmarshaller
uri = "http://time.xmlrpc.com/RPC2"
server = ServerProxy(uri, transport=MyTransport(use_datetime=True))
print server.currentTime.getCurrentTime()
----------
nosy: +amaury.forgeotdarc
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue8792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com