DateTime, timestamptz, Zope2, and PsycopgDA
"Ross J. Reedstrom" <reedstrm-OhmvVRJSr/[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
Sorry about the subject and threading: I've changed it now. Further, I can't get timestamptz to work with native datetime either. I suspect if I could get it to return mx.DateTime objects it might work. Ross On Wed, Jan 20, 2010 at 04:46:21PM -0600, Ross J. Reedstrom wrote: > On Wed, Nov 25, 2009 at 09:42:27PM +0100, Brian Sutherland wrote: > > > > 2.9 and I think we'll stick with that for quite some years more. > > Hmm, I see this probably the place for my questions. I've been beating > my head against updating a Zope 2 app (2.9.10) from psycopg1 to > psycopg2. > I've got pretty much everything resolved (I enjoyed deleting my own > custom 'convert all these strings to python types' code) except using > Zope DateTime is not behaving well for me. This is using PG 8.3, Zope > 2.9.10, Plone 2.5, and psycopg 2.0.13 (under Ubuntu, w/ psycopg inside > buildout, so custom compile) > > On any query that attempts to return a timestamptz value, I get: > > [...] > Module Products.ZPsycopgDA.db, line 190, in query > Module Products.ZPsycopgDA.DA, line 215, in _cast_DateTime > Module DateTime.DateTime, line 509, in __init__ > Module DateTime.DateTime, line 733, in _parse_args > Module DateTime.DateTime, line 1111, in _parse > SyntaxError: 2010-01-20 15:36:05-06 > > (which looks suspiciously like the string representation postgresql > uses) > > If I use psycopg2 directly, I get the appropriate datetime object > returned. I'm surprised to see the datetime type being flattened to a > string and reparsed. I'm having a bit of trouble finding how the 'iso' > string passed to _cast_DateTime is being generated. The issue there is > that the casting method is expecting the timezone as a whitespace > seperated value, in a different format. > > Anyone know the trick for making this work? > > Ross > -- > Ross Reedstrom, Ph.D. reedstrm-OhmvVRJSr/[email protected] > Systems Engineer & Admin, Research Scientist phone: 713-348-6166 > The Connexions Project http://cnx.org fax: 713-348-3665 > Rice University MS-375, Houston, TX 77005 > GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE > > _______________________________________________ > Psycopg mailing list > Psycopg-IAPFreCvJWPBWskQ1e/[email protected] > http://lists.initd.org/mailman/listinfo/psycopg >