mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-29 04:13:43 +03:00
Infinity ok in Zope (closes: #122)
This commit is contained in:
parent
4820213b7f
commit
5689f07de4
|
@ -1,5 +1,7 @@
|
||||||
2006-09-30 Federico Di Gregorio <fog@initd.org>
|
2006-09-30 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
|
* ZpsycopgDA/DA.py: applied the infinity patch from 1.1 (fixes #122).
|
||||||
|
|
||||||
* psycopg/adapter_datetime.py: fixed conversion problem with seconds
|
* psycopg/adapter_datetime.py: fixed conversion problem with seconds
|
||||||
in the (59,60) range (fixes #131).
|
in the (59,60) range (fixes #131).
|
||||||
|
|
||||||
|
|
|
@ -221,6 +221,9 @@ for icon in ('table', 'view', 'stable', 'what', 'field', 'text', 'bin',
|
||||||
# convert an ISO timestamp string from postgres to a Zope DateTime object
|
# convert an ISO timestamp string from postgres to a Zope DateTime object
|
||||||
def _cast_DateTime(iso, curs):
|
def _cast_DateTime(iso, curs):
|
||||||
if iso:
|
if iso:
|
||||||
|
if iso in ['-infinity', 'infinity']:
|
||||||
|
return iso
|
||||||
|
else:
|
||||||
return DateTime(re.split("GMT\+?|GMT-?|\+|-", iso)[0])
|
return DateTime(re.split("GMT\+?|GMT-?|\+|-", iso)[0])
|
||||||
|
|
||||||
# this will split us into [date, time, GMT/AM/PM(if there)]
|
# this will split us into [date, time, GMT/AM/PM(if there)]
|
||||||
|
@ -236,6 +239,9 @@ def _cast_DateTime(iso, curs):
|
||||||
# convert an ISO date string from postgres to a Zope DateTime object
|
# convert an ISO date string from postgres to a Zope DateTime object
|
||||||
def _cast_Date(iso, curs):
|
def _cast_Date(iso, curs):
|
||||||
if iso:
|
if iso:
|
||||||
|
if iso in ['-infinity', 'infinity']:
|
||||||
|
return iso
|
||||||
|
else:
|
||||||
return DateTime(iso)
|
return DateTime(iso)
|
||||||
|
|
||||||
# Convert a time string from postgres to a Zope DateTime object.
|
# Convert a time string from postgres to a Zope DateTime object.
|
||||||
|
@ -243,6 +249,9 @@ def _cast_Date(iso, curs):
|
||||||
# that it has the same DST settings.
|
# that it has the same DST settings.
|
||||||
def _cast_Time(iso, curs):
|
def _cast_Time(iso, curs):
|
||||||
if iso:
|
if iso:
|
||||||
|
if iso in ['-infinity', 'infinity']:
|
||||||
|
return iso
|
||||||
|
else:
|
||||||
return DateTime(time.strftime('%Y-%m-%d %H:%M:%S',
|
return DateTime(time.strftime('%Y-%m-%d %H:%M:%S',
|
||||||
time.localtime(time.time())[:3]+
|
time.localtime(time.time())[:3]+
|
||||||
time.strptime(iso[:8], "%H:%M:%S")[3:]))
|
time.strptime(iso[:8], "%H:%M:%S")[3:]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user