Lennart Regebro wrote:
On 10/5/07, Laurence Rowe <[EMAIL PROTECTED]> wrote:
I've tested my patch (datetime.datetime support) against Amos's branch
and it applies cleanly and all tests pass.

Cool! Are there tests to make sure old pickles still work, or do we
know that this is the case for sure?

My patch updates the existing test (substituting _millis for _micros):

    def testUpgradeOldInstances(self):
        # Compare dates that don't have the _micros attribute yet
        dt = DateTime('1997/1/1')
        dt1 = DateTime('1997/2/2')
        del dt._micros
        del dt1._micros
        self.testCompareOperations(dt, dt1)

If anyone thinks it is important I could an explicit upgrade path for instances with a _millis attribute too (most current instances I would assume). _upgrade_old should work fine for them too as they have a time float _t attribute.

    def _upgrade_old(self):
        """Upgrades a previously pickled DateTime object."""
        micros = long(math.floor(self._t * 1000000.0))
        self._micros = micros
        return micros


Zope-Dev maillist  -  Zope-Dev@zope.org
**  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