Commit c205c318 authored by Jérome Perrin's avatar Jérome Perrin

Formulator: py3

parent 8591c92b
...@@ -1563,7 +1563,7 @@ class DateTimeWidget(Widget): ...@@ -1563,7 +1563,7 @@ class DateTimeWidget(Widget):
format_dict = self.format_to_sql_format_dict format_dict = self.format_to_sql_format_dict
input_order = format_dict.get(self.getInputOrder(field), input_order = format_dict.get(self.getInputOrder(field),
self.sql_format_default) self.sql_format_default)
if isinstance(value, six.text_type): if six.PY2 and isinstance(value, six.text_type):
value = value.encode(field.get_form_encoding()) value = value.encode(field.get_form_encoding())
return {'query': value, return {'query': value,
'format': field.get_value('date_separator').join(input_order), 'format': field.get_value('date_separator').join(input_order),
...@@ -2126,7 +2126,7 @@ class FloatWidget(TextWidget): ...@@ -2126,7 +2126,7 @@ class FloatWidget(TextWidget):
# field. # field.
for x in xrange(0, precision): for x in xrange(0, precision):
format += '0' format += '0'
if isinstance(value, six.text_type): if six.PY2 and isinstance(value, six.text_type):
value = value.encode(field.get_form_encoding()) value = value.encode(field.get_form_encoding())
return {'query': value, return {'query': value,
'format': format, 'format': format,
......
...@@ -36,8 +36,10 @@ class FakeRequest: ...@@ -36,8 +36,10 @@ class FakeRequest:
def clear(self): def clear(self):
self.dict.clear() self.dict.clear()
def __nonzero__(self): def __bool__(self):
return 0 return False
if six.PY2:
__nonzero__ = __bool__
class SerializeTestCase(unittest.TestCase): class SerializeTestCase(unittest.TestCase):
def test_simpleSerialize(self): def test_simpleSerialize(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment