mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-12-01 21:23:43 +03:00
Use bytestrings in infinite dates adapter example
Returning strings would result in unclear tracebacks on Py3 (see ticket #163).
This commit is contained in:
parent
2e3833f7fb
commit
bc70902ea5
|
@ -554,9 +554,9 @@ to map `date.max` to :sql:`infinity`, for instance::
|
||||||
self.wrapped = wrapped
|
self.wrapped = wrapped
|
||||||
def getquoted(self):
|
def getquoted(self):
|
||||||
if self.wrapped == datetime.date.max:
|
if self.wrapped == datetime.date.max:
|
||||||
return "'infinity'::date"
|
return b"'infinity'::date"
|
||||||
elif self.wrapped == datetime.date.min:
|
elif self.wrapped == datetime.date.min:
|
||||||
return "'-infinity'::date"
|
return b"'-infinity'::date"
|
||||||
else:
|
else:
|
||||||
return psycopg2.extensions.DateFromPy(self.wrapped).getquoted()
|
return psycopg2.extensions.DateFromPy(self.wrapped).getquoted()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user