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


Attachment: pgpztiAiCXQb1.pgp
Description: PGP signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to