[Psycopg] problem with timezone parsing

James Henstridge james at jamesh.id.au
Tue Feb 17 15:39:30 CET 2009


On Tue, Feb 17, 2009 at 8:04 PM, Karsten Hilbert
<Karsten.Hilbert at gmx.net> wrote:
>> 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 ?

You can call the other typecaster directly:

    timestamp = psycopg2.DATETIME(some_string, cursor)

Your typecast function will be passed the string and cursor as arguments.

James.


More information about the Psycopg mailing list