Re: problem with timezone parsing

Karsten Hilbert <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Tue, Feb 17, 2009 at 03:16:37PM +0900, James Henstridge wrote:

> I had a bit of a poke at the datetime parsing code, and have updated
> it to handle things slightly better.
> 
> * The typecast_parse_time() function can now parse HH:MM:SS time zones.
> * The typecast_PYDATETIME_cast() methods now explicitly check for
> offsets that are not a whole number of minutes and raise an exception
> ("time zone offset NNNN is not a whole number of minutes").
> * The typecast_PYTIME_cast() method now supports times with time
> zones, for completeness.
> * The test suite has been updated to actually test the time zone
> parsing, ensuring that the correct results are returned. The tests
> for the mxDateTime backend essentially just show that the time zone
> info is dropped, since it doesn't support time zones.
>
> The extra tests turned up a bug in the handling of offsets that aren't
> a whole number of hours: offsets like "-01:15" were being treated as a
> 45 minute offset rather than 75 minutes.  That is also now fixed, but
> ity does mean that released versions of psycopg can silently return
> incorrect data if you are relying on its time zone parsing.

Thanks.

> As mentioned before, if you want behaviour different to this I'd
> suggest installing an alternative typecaster.  That would also let you
> fix the busted time zone parsing for released versions of psycopg2.

Is there a way to install a custom typecaster, then from
inside which letting the default typecaster handle things
but listen for the above exception and handle that
appropriately ?

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.