Use bytestrings in infinite dates adapter example

Returning strings would result in unclear tracebacks on Py3 (see ticket #163).
This commit is contained in:
Daniele Varrazzo 2013-10-21 14:30:25 +01:00
parent 8d8cc38590
commit 58c53025d1

View File

@ -554,9 +554,9 @@ to map `date.max` to :sql:`infinity`, for instance::
self.wrapped = wrapped
def getquoted(self):
if self.wrapped == datetime.date.max:
return "'infinity'::date"
return b"'infinity'::date"
elif self.wrapped == datetime.date.min:
return "'-infinity'::date"
return b"'-infinity'::date"
else:
return psycopg2.extensions.DateFromPy(self.wrapped).getquoted()