Re: psycopg2: parsing timestamps with odd time zones
Karsten Hilbert <[email protected]> Wed, 19 May 2010 23:11:30 +0200
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello Daniele, hello Frederico,
thanks for making psycopg2 better from release to release !
While we are in the mood shall we consider another minor
glitch ? ;-)
"qouting mxDateTime objects into timestamps while locale is ative"
GNUmed is using this code to get by:
class cAdapterMxDateTime(object):
def __init__(self, dt):
if dt.tz == '???':
_log.info('[%s]: no time zone string available in (%s), assuming local time zone', self.__class__.__name__, dt)
self.__dt = dt
def getquoted(self):
# under some locale settings the mx.DateTime ISO formatter
# will insert "," into the ISO string,
# while this is allowed per the ISO8601 spec PostgreSQL
# cannot currently handle that,
# so map those "," to "." to make things work:
return mxDT.ISO.str(self.__dt).replace(',', '.')
I would appreciate discussion of this and perhaps inclusion
in psycopg2 ...
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346