From 3789f8fb1763c2ea18035ca25b4a4ca6ed39de85 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 13 Feb 2010 03:22:02 +0000 Subject: [PATCH] Added other info about tz module. --- doc/cursor.rst | 9 +++++++++ doc/tz.rst | 4 ++-- lib/tz.py | 8 +++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/doc/cursor.rst b/doc/cursor.rst index 1a13a4b9..69b30427 100644 --- a/doc/cursor.rst +++ b/doc/cursor.rst @@ -482,3 +482,12 @@ The ``cursor`` class .. versionadded:: 2.0.6 + + .. attribute:: tzinfo_factory + + The time zone factory used to handle data types such as + :sql:`TIMESTAMP WITH TIME ZONE`. It should be a |tzinfo|_ object. + See also the :mod:`psycopg2.tz` module. + + .. |tzinfo| replace:: :class:`!tzinfo` + .. _tzinfo: http://docs.python.org/library/datetime.html#tzinfo-objects diff --git a/doc/tz.rst b/doc/tz.rst index 1a6f5244..3cac88c1 100644 --- a/doc/tz.rst +++ b/doc/tz.rst @@ -6,11 +6,11 @@ .. module:: psycopg2.tz This module holds two different tzinfo implementations that can be used as the -:obj:`tzinfo` argument to datetime constructors, directly passed to psycopg +:obj:`tzinfo` argument to datetime constructors, directly passed to Psycopg functions or used to set the :attr:`cursor.tzinfo_factory` attribute in cursors. -.. todo:: tz module +.. todo:: should say something more about tz handling .. autoclass:: psycopg2.tz.FixedOffsetTimezone diff --git a/lib/tz.py b/lib/tz.py index 1584c28e..9f078c77 100644 --- a/lib/tz.py +++ b/lib/tz.py @@ -34,9 +34,11 @@ ZERO = datetime.timedelta(0) class FixedOffsetTimezone(datetime.tzinfo): """Fixed offset in minutes east from UTC. - This is exactly the implementation found in Python 2.3.x documentation, - with a small change to the __init__ method to allow for pickling and a - default name in the form 'sHH:MM' ('s' is the sign.) + This is exactly the implementation__ found in Python 2.3.x documentation, + with a small change to the :meth:`!__init__` method to allow for pickling + and a default name in the form ``sHH:MM`` (``s`` is the sign.). + + .. __: http://docs.python.org/library/datetime.html#datetime-tzinfo """ _name = None _offset = ZERO