xmlrpclib and mx.DateTime
Skip Montanaro
skip at pobox.com
Tue Jan 29 21:04:11 EST 2002
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:
try:
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)
else:
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
...
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list