PY* and MX* typecasters imported into the extensions module.

This commit is contained in:
Daniele Varrazzo 2010-04-14 00:27:28 +01:00
parent 54e9c89ea4
commit d162c08cfa
3 changed files with 25 additions and 3 deletions

View File

@ -2,6 +2,8 @@
* lib/extensions.py: DECIMAL typecaster imported from _psycopg. * 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> 2010-04-05 Federico Di Gregorio <fog@initd.org>
* Fixed problem with asynchronous NOTIFYs. * Fixed problem with asynchronous NOTIFYs.

View File

@ -512,7 +512,24 @@ from the database. See :ref:`unicode-handling` for details.
UNICODE UNICODE
UNICODEARRAY 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 .. versionchanged:: 2.2.0
previously the `DECIMAL` typecaster was not exposed by the previously the `DECIMAL` typecaster and the specific time-related
`extensions` module. In older versions it can be imported from the typecasters (`!PY*` and `!MX*`) were not exposed by the `extensions`
implementation module `!psycopg2._psycopg`. module. In older versions they can be imported from the implementation
module `!psycopg2._psycopg`.

View File

@ -41,11 +41,14 @@ from _psycopg import UNICODEARRAY
from _psycopg import Binary, Boolean, Float, QuotedString, AsIs from _psycopg import Binary, Boolean, Float, QuotedString, AsIs
try: try:
from _psycopg import MXDATE, MXDATETIME, MXINTERVAL, MXTIME
from _psycopg import DateFromMx, TimeFromMx, TimestampFromMx from _psycopg import DateFromMx, TimeFromMx, TimestampFromMx
from _psycopg import IntervalFromMx from _psycopg import IntervalFromMx
except: except:
pass pass
try: try:
from _psycopg import PYDATE, PYDATETIME, PYINTERVAL, PYTIME
from _psycopg import DateFromPy, TimeFromPy, TimestampFromPy from _psycopg import DateFromPy, TimeFromPy, TimestampFromPy
from _psycopg import IntervalFromPy from _psycopg import IntervalFromPy
except: except: