[Zope-dev] Options replacing DateTime with datetime!?

Andreas Jung lists at zopyx.com
Sat Aug 25 11:47:54 EDT 2007


Hi,

perhaps the sun burned too long on my brain today but I investigated some 
options for replacing DateTime with Python's datetime module. Zope 3 uses
datetime and we all know that the DateTime implementation sucks. Especially 
the timezone implementation has a bunch of problems (count the bugtracker 
issues related to timezone errors).

Constraints:
We can not get rid of the DateTime class and its API for backward 
compatibility reasons.

Idea:
The DateTime class remains in place and uses an instance attribute to 
represent the original value of a DateTime object as instance of datetime.
Calls to the old DateTime API are proxied to corresponding calls of
the datetime API (or emulated)

Efforts so far:
I have some quick-and-dirty implementation that can construct the
datetime instance directly within the DateTime constructor and when
loading an object from the ZODB (using a custom __setstate__()
implementation...could be used for an on-the-fly migration). This seems to 
work properly. For timezone related issues I am using pytz. However there 
is a problem with using pytz: the timezone names supported by pytz are 
sometimes different from the standard one. E.g. 'GMT+0400' is represented 
in pytz as '/Etc/GMT+0400'...however that seems to be solvable.

Before digging deeper I would like to hear some opinions if this seems a 
reasonable approach? Unlikely that we can achieve 100% backward 
compatibility but possibly 99%....thoughts...comments?

Tnx,
Andreas


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20070825/a8f26e22/attachment.bin


More information about the Zope-Dev mailing list