From d162c08cfafc78c7e66465b39eda944367854480 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 14 Apr 2010 00:27:28 +0100 Subject: [PATCH] PY* and MX* typecasters imported into the extensions module. --- ChangeLog | 2 ++ doc/src/extensions.rst | 23 ++++++++++++++++++++--- lib/extensions.py | 3 +++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11c7964c..23ec09b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * lib/extensions.py: DECIMAL typecaster imported from _psycopg. + * lib/extensions.py: PY* and MX* time typecaster imported from _psycopg. + 2010-04-05 Federico Di Gregorio * Fixed problem with asynchronous NOTIFYs. diff --git a/doc/src/extensions.rst b/doc/src/extensions.rst index 7a02e4df..0361b3ea 100644 --- a/doc/src/extensions.rst +++ b/doc/src/extensions.rst @@ -512,7 +512,24 @@ from the database. See :ref:`unicode-handling` for details. UNICODE UNICODEARRAY +Typecasters to convert time-related data types to Python `!datetime` objects: + +.. data:: PYDATE + PYDATETIME + PYINTERVAL + PYTIME + +Typecasters to convert time-related data types to `mx.DateTime`_ objects. Only +available if Psycopg was compiled with `!mx` support. + +.. data:: MXDATE + MXDATETIME + MXINTERVAL + MXTIME + .. versionchanged:: 2.2.0 - previously the `DECIMAL` typecaster was not exposed by the - `extensions` module. In older versions it can be imported from the - implementation module `!psycopg2._psycopg`. + previously the `DECIMAL` typecaster and the specific time-related + typecasters (`!PY*` and `!MX*`) were not exposed by the `extensions` + module. In older versions they can be imported from the implementation + module `!psycopg2._psycopg`. + diff --git a/lib/extensions.py b/lib/extensions.py index 4627d088..20f78e69 100644 --- a/lib/extensions.py +++ b/lib/extensions.py @@ -41,11 +41,14 @@ from _psycopg import UNICODEARRAY from _psycopg import Binary, Boolean, Float, QuotedString, AsIs try: + from _psycopg import MXDATE, MXDATETIME, MXINTERVAL, MXTIME from _psycopg import DateFromMx, TimeFromMx, TimestampFromMx from _psycopg import IntervalFromMx except: pass + try: + from _psycopg import PYDATE, PYDATETIME, PYINTERVAL, PYTIME from _psycopg import DateFromPy, TimeFromPy, TimestampFromPy from _psycopg import IntervalFromPy except: