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 2e3833f7fb
commit bc70902ea5

View File

@ -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()