trying to wrap xmlrpclib into classes

Skip Montanaro skip at pobox.com
Wed Jan 22 10:02:30 EST 2003


    >> I'm coming in late to this thread, but use XML-RPC all the time.
    >> Other than the initial setup of a server proxy and the fact that
    >> XML-RPC can't quite pass all Python data types, can you describe what
    >> "XMLRPC'ish" is?

    Steven> Having to pass in xmlrpclib.DateTime objects into certain
    Steven> methods, and this 'server object' that is hanging around in your
    Steven> logic which I don't like.

Well, it's really not a server object, but a proxy for another object which
happens to live on another computer.

I think the business of xmlrpclib.DateTime objects will probably improve
over time.  Python is in the midst of growing a datetime module of its own.
You'll still have to import the module to use it, but eventually, what you
pass won't be a wrapper object defined in the xmlrpclib module.  Ditto for
xmlrpclib.Boolean.

    Steven> page = Page('Main', 'http://wiki.cocoondev.org/RPC2/')

Since the default path is "/RPC2" (that is, xmlrpclib will send a POST
request to the server with "/RPC2" as the path), why are you giving that?

    Steven> pageInfo = page.retrievePageInfo()
    Steven> version = page.getVersion()
    Steven> author = page.getAuthor()
    Steven> lastModified = page.getlastModified()

This looks very vanilla.

    Steven> twodays = 60*60*24*2
    Steven> twodaysago = time.gmtime(time.time() - twodays)
    Steven> changes = RecentChanges('http://wiki.cocoondev.org/RPC2/')
    Steven> rc = changes.getRecentChanges(twodaysago)

As does this.  Do you wrap twodaysago in a DateTime object locally or just
pass it along as a tuple?

    Steven> rc being a dictionary of a sequence of built-in types with a
    Steven> proper lookup key rather than a list of dictionary objects which
    Steven> the default xmlrpclib creates for an XMLRPC array.

This I can't quite parse.  Are you complaining that it does something funky
with lists or dicts?  Can you give a concrete example?

Skip





More information about the Python-list mailing list