xmlrpclib and mx.DateTime
ChuckEsterbrook at StockAlerts.com
Thu Jan 31 01:18:58 CET 2002
On Tuesday 29 January 2002 06:04 pm, Skip Montanaro wrote:
> Chuck> Does anyone have a patch lying about to make xmlrpclib and
> Chuck> mx.DateTime play nice together?
> Something like this modified (and untested) xmlrpclib.DateTime
> constructor ought to work:
> import mx.DateTime
> except ImportError:
> mx = None
> class DateTime:
> def __init__(self, value=0):
> fmt = "%Y%m%dT%H:%M:%S"
> if mx is not None and isinstance(value,
> mx.DateTime.DateTimeType): value = value.strftime(fmt)
> if not isinstance(value, StringType):
> if not isinstance(value, TupleType):
> if value == 0:
> value = time.time()
> value = time.localtime(value)
> value = time.strftime(fmt, value)
> self.value = value
Thanks. That essentially works except for the missing dispatch:
def dump_DateTime(self, value):
dispatch[mx.DateTime.DateTimeType] = dump_DateTime
Next, xmlrpclib.py complained about None (I'm sending over a dict of
information with various contents). So I put that in.
Now it complains that my longs are too big.
At this point I've decided XML-RPC is not for me. I'll enhance Webware
to include a PickleRPCServlet to complement it's existing XMLRPCServlet.
Those wanting something Pythonic can use the former, and those wanting
XML-RPC compliance can use the latter.
More information about the Python-list