Use BaseTzInfo as base class for all objects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Fix Released
|
Medium
|
Stuart Bishop |
Bug Description
I'm trying to use pytz objects in combination with psycopg2. In order to automatically convert objects in query parameters, one can register a so called adapter.
Psycopg2 detects which type something is from its class, and uses isinstance to match it up with the registered adapter for that type.
I tried registering an adapter for pytz.tzinfo.
To avoid this, I now have to register both an adapter for type(pytz.UTC) (because it's a singleton and not a class, I have to use type()) _and_ for pytz.tzinfo.
For information on adapting type in psycopg2, see http://
Changed in pytz: | |
status: | Triaged → In Progress |
assignee: | nobody → Stuart Bishop (stub) |
Changed in pytz: | |
status: | In Progress → Fix Released |
A common base class is certainly possible, and BaseTzInfo is likely the best candidate.