xmlrpclib: how to marshal special instances

W

Willi Langenberger

Hi!


We have an application server (Zope) and make heavy use of
xml-rpc. One problem arised, when we tried to return a zope.DateTime
instance. xmlrpclib (naturally) knows nothing about zope.DateTime and
marshalls it as instance, which gives a structure (of zope.DateTime
attributes) on the client side (which isnt very usable).

It seems we have two possibilities:

1) Convert all zope.DateTime instances to xmlrpclib.DateTime instances
in our appserver program. (This would be a burden for every
appserver programmer.)

2) Tell xmlrpclib how to marshal zope.DateTime instances as
xmlrpclib.DateTime objects.

We are in favour of 2, and would like to patch Zope, so that
zope.DateTime objects automatically recieve as xmlrpc date types on
the client side.

Schematically:

import xmlrpclib

# zope.DateTime must have an "encode" method
xmlrpclib.WRAPPERS = xmlrpclib.WRAPPERS + (zope.DateTime,)

However, we do not know, if the WRAPPERS tuple is an "official" API,
and if we should use it that way. (We'd like to know before we try to
get a patch into the Zope core...)

Or, are there other (better!) ways to solve the problem (marshal
zope.DateTime as xml-rpc date without modifying xmlrpclib)?


Thanks!


\wlang{}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,630
Members
45,334
Latest member
66Zeinab9

Latest Threads

Top