>>> from vice.zope2.outbound.utils import DT2dt, dt2DT
>>> from DateTime import DateTime
>>> from datetime import datetime
>>> from pytz import timezone

>>> def RFC3339(date):
...     try:
...         date = date.toZone("UTC")
...         date = DT2dt(date)
...     except:
...         date = datetime(*date.utctimetuple()[:6])
...     return date.strftime('%Y-%m-%dT%H:%M:%SZ')


First, we see that using DT2dt() and RFC3339() work in a basic case.


>>> DT = DateTime('1997/3/9 13:45:00 US/Eastern')
>>> dt = DT2dt(DT)
>>> DT_alt = dt2DT(dt)
>>> DT_alt == DT
True
>>> RFC3339(dt) == RFC3339(DT)
True


Then we see that they work for a particular date we're going to examine from the ZODB.


>>> dt = datetime(2007, 4, 2, 14, 28, 30, 00, timezone('US/Central'))
>>> DT = dt2DT(dt)
>>> RFC3339(dt) == RFC3339(DT)
True


Grab the actual date from the ZODB test data for Plone 3.0 beta 3.


>>> DT2 = self.portal['front-page'].created()
>>> dt2 = DT2dt(DT2)


And here we see the bug...

>>> #RFC3339(dt2) + '==' +  RFC3339(DT2)  #Old test
>>> RFC3339(dt2) ==  RFC3339(DT2)
True
