summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--doc/src/extensions.rst23
-rw-r--r--lib/extensions.py3
3 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 11c7964..23ec09b 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 <fog@initd.org>
* Fixed problem with asynchronous NOTIFYs.
diff --git a/doc/src/extensions.rst b/doc/src/extensions.rst
index 7a02e4d..0361b3e 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 4627d08..20f78e6 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: