Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, bhargav, bquinlan, bra, loewis
Date 2010-10-02.16:58:14
SpamBayes Score 0.00040708
Marked as misclassified No
Message-id <1286038696.96.0.282287891723.issue8792@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2010-10-02 16:58:17amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, loewis, bquinlan, bra, bhargav
2010-10-02 16:58:16amaury.forgeotdarcsetmessageid: <1286038696.96.0.282287891723.issue8792@psf.upfronthosting.co.za>
2010-10-02 16:58:15amaury.forgeotdarclinkissue8792 messages
2010-10-02 16:58:14amaury.forgeotdarccreate