Make sure to return a bytes string from numeric range adapter

This commit is contained in:
Daniele Varrazzo 2013-04-21 20:30:03 +01:00
parent d159dfea9d
commit fc2ca0d2e9

View File

@ -415,7 +415,7 @@ class NumberRangeAdapter(RangeAdapter):
def getquoted(self): def getquoted(self):
r = self.adapted r = self.adapted
if r.isempty: if r.isempty:
return "'empty'" return b("'empty'")
if not r.lower_inf: if not r.lower_inf:
# not exactly: we are relying that none of these object is really # not exactly: we are relying that none of these object is really
@ -431,8 +431,8 @@ class NumberRangeAdapter(RangeAdapter):
else: else:
upper = '' upper = ''
return b("'%s%s,%s%s'" % ( return ("'%s%s,%s%s'" % (
r._bounds[0], lower, upper, r._bounds[1])) r._bounds[0], lower, upper, r._bounds[1])).encode('ascii')
# TODO: probably won't work with infs, nans and other tricky cases. # TODO: probably won't work with infs, nans and other tricky cases.
register_adapter(NumericRange, NumberRangeAdapter) register_adapter(NumericRange, NumberRangeAdapter)