By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

xmlrpclib: how to marshal special instances

P: n/a
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{}

--
Wi****************@wu-wien.ac.at Fax: +43/1/31336/9207
Zentrum fuer Informatikdienste, Wirtschaftsuniversitaet Wien, Austria
Oct 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.