From: Billy G. A. <bal...@us...> - 2005-05-16 21:56:50
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3623/pyPgSQL Modified Files: PgSQL.py Log Message: 15MAY2005 bga - A change to the datetime parsing changed the default datetime object from localtime to UTC. This update returns the default to localtime and adds a new variable, 'useUTCtimeValue' to control the default value of a datetime object. Setting it to 1 will cause the datetime object to reference the UTC time, 0 will cause the datetime object to reference the client's local time zone. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** PgSQL.py 6 Mar 2005 20:00:08 -0000 1.47 --- PgSQL.py 16 May 2005 03:37:56 -0000 1.48 *************** *** 1,3 **** ! #ident "@(#) $Id$" # vi:set sw=4 ts=8 showmode ai: #--(H+)-----------------------------------------------------------------+ --- 1,3 ---- ! #ident "@(#) $Il: PgSQL.py,v 1.47 2005/03/06 20:00:08 ballie01 Exp $" # vi:set sw=4 ts=8 showmode ai: #--(H+)-----------------------------------------------------------------+ *************** *** 30,33 **** --- 30,41 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 15MAY2005 bga - A change to the datetime parsing changed the default | + # datetime object from localtime to UTC. This update | + # returns the default to localtime and adds a new vari- | + # able, 'useUTCtimeValue' to control the default value | + # of a datetime object. Setting it to 1 will cause the | + # datetime object to reference the UTC time, 0 will | + # cause the datetime object to reference the client's | + # local time zone. | # 27FEB2005 bga - Bug fix release to catch up with the outstanding bug | # reports. | *************** *** 446,449 **** --- 454,466 ---- noPostgresCursor = 0 + # Setting this variable to 1 will cause the datatime instance returned from + # the result set for a timestame with timezone to reference the corresponding + # UTC time value (not the value expressed in the clients time zone). + + useUTCtimeValue = 0 + + # Define the regular expresions used to determin the type of SQL statement + # that is being executed. + re_DQL = re.compile('^[\s]*SELECT[\s]', re.I) re_DRT = re.compile('[\s]*DROP[\s]+TABLE[\s]', re.I) *************** *** 909,914 **** return self.interval2RelativeDateTime(value) else: ! return DateTime.Parser.DateTimeFromString(value) ! #return DateTime.ISO.ParseAny(value) elif _ftv == BINARY: if isinstance(value, PgBytea) or type(value) is PgLargeObjectType: --- 926,933 ---- return self.interval2RelativeDateTime(value) else: ! if (useUTCtimeValue): ! return DateTime.Parser.DateTimeFromString(value) ! else: ! return DateTime.Parser.DateTimeFromString(value).localtime() elif _ftv == BINARY: if isinstance(value, PgBytea) or type(value) is PgLargeObjectType: |