[Zope] DateTime mess

Philipp von Weitershausen philipp at weitershausen.de
Tue Nov 29 06:10:29 EST 2005


Chris Withers wrote:
> Philipp von Weitershausen wrote:
> 
>> I think we need Zope to use some frankendatetime (a datetime.datetime
>> that also supports the old DateTime API) throughout the deprecation
>> period. Whenever people make a call to the old DateTime API on a
>> frankendatetime object, they'll get a deprecation warning telling them
>> to use the datetime.datetime API instead. After the deprecation phase is
>> over, Zope 2 can return pure datetime.datetime objects.
> 
> 
> I don't see any need for diabolical creations ;-) Just the deprecation
> warnings will suffice.
> (...which will promptly be added to warn filters, and only fixed when
> DateTime really goes away *sigh*)

Ok, so take this example:

A piece of code calls bobobase_modification_time() which currently
returns a DateTime; after that the piece of code calls some
DateTime-specific methods on the returned object. Now in Zope 2.12 we
make bobobase_modification_time() return a datetime.datetime and
subsequently the piece of code would fail. There are a lot of pieces of
code like this in third party products...

We could deprecate DateTime now to warn people about that. But then
their product would only either work with Zope <2.12 or with Zope >2.12
(depending on whether it still expects the DateTime API or the
datetime.datetime API); it would not with both versions. That's a harsh
upgrade plan and it would probably take ages before people would adopt
Zope 2.12.

With a frankendatetime in Zope 2.10, however, they could still call
DateTime-specific methods on the return value of
bobobase_modification_time(). They'd get deprecation warnings telling
them to use the datetime.datetime API instead. That would work
instantly, not only in Zope 2.12. That way they could smoothly upgrade
their products.


By the way, I've come to think that touching the current DateTime
implementation wouldn't be a good idea, mostly because of the old
pickles issue. The frankendatetime should be a separate class that
subclasses datetime.datetime, provides old-style DateTime compatability
and has datetime.datetime-compatible pickles.

Philipp


More information about the Zope mailing list