Tres Seaver wrote:
> I can't reproduce with this test. Note that I verified that dt.__dict__
> matches the one in the 2.9 'datum' above.
>
> def test_strftime_old_instance(self):
> # https://bugs.launchpad.net/zope2/+bug/290254
> # Ensure that dates without _micros attribute (e.g., from old
> # pickles) still render correctly in strftime.
> ISO = '2001-10-10T00:00:00+02:00'
> dt = DateTime(ISO)
> dt._millis = dt._micros / 1000
> del dt._micros
> self.assertEqual(dt.strftime('%Y'), '2001')
I have a version of the test which actually emulates the ZODB load. The
bad news is that it passes as well::
def test_strftime_old_instance(self):
# https://bugs.launchpad.net/zope2/+bug/290254
# Ensure that dates without _micros attribute (e.g., from old
# pickles) still render correctly in strftime.
ISO = '2001-10-10T00:00:00+02:00'
dt = DateTime(ISO)
dt._millis = dt._micros / 1000
del dt._micros self.assertEqual(dt.strftime('%Y'), '2001')
# Now, create one via pickling / unpickling.
from cStringIO import StringIO
buf = StringIO()
from cPickle import Pickler
pickler = Pickler(buf, 1)
state = pickler.dump(dt)
buf.seek(0)
from cPickle import Unpickler
unpickler = Unpickler(buf)
dt1 = unpickler.load()
self.assertEqual(dt.strftime('%Y'), '2001')
- --
===================================================================
Tres Seaver +1 540-429-0999 <email address hidden>
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tres Seaver wrote: old_instance( self): /bugs.launchpad .net/zope2/ +bug/290254 10T00:00: 00+02:00' l(dt.strftime( '%Y'), '2001')
> I can't reproduce with this test. Note that I verified that dt.__dict__
> matches the one in the 2.9 'datum' above.
>
> def test_strftime_
> # https:/
> # Ensure that dates without _micros attribute (e.g., from old
> # pickles) still render correctly in strftime.
> ISO = '2001-10-
> dt = DateTime(ISO)
> dt._millis = dt._micros / 1000
> del dt._micros
> self.assertEqua
I have a version of the test which actually emulates the ZODB load. The
bad news is that it passes as well::
def test_strftime_ old_instance( self): /bugs.launchpad .net/zope2/ +bug/290254 10T00:00: 00+02:00'
self.assertEqu al(dt.strftime( '%Y'), '2001')
# https:/
# Ensure that dates without _micros attribute (e.g., from old
# pickles) still render correctly in strftime.
ISO = '2001-10-
dt = DateTime(ISO)
dt._millis = dt._micros / 1000
del dt._micros
# Now, create one via pickling / unpickling.
from cStringIO import StringIO
buf = StringIO()
from cPickle import Pickler
pickler = Pickler(buf, 1)
state = pickler.dump(dt)
buf.seek(0)
from cPickle import Unpickler
unpickler = Unpickler(buf)
dt1 = unpickler.load()
- -- ======= ======= ======= ======= ======= ======= ======= ======= ==== palladion. com enigmail. mozdev. org
=======
Tres Seaver +1 540-429-0999 <email address hidden>
Palladion Software "Excellence by Design" http://
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iD8DBQFJrqjY+ gerLs4ltQ4RAsr9 AJ93uWSco00gxfc zMQ2oG16pGrlx/ QCdH7Gp HXzcAg9c=
1PdjtFrlLNIKRlJ
=5cEt
-----END PGP SIGNATURE-----