Include tests from PR, fixes #105.

This commit is contained in:
Friedrich Lindenberg
2015-05-21 16:47:36 +02:00
3 changed files with 29 additions and 20 deletions
+1 -9
View File
@@ -8,15 +8,7 @@ from dataset.freeze.format.common import Serializer
def value_to_str(value):
if isinstance(value, datetime):
#
# FIXME: this check does not work for values returned from a db query!
# As a workaround, we make sure, the isoformat call returns the regular
# str representation.
#
sep = ' ' if PY3 else str(' ')
return text_type(value.isoformat(sep=sep))
if isinstance(value, date):
if isinstance(value, (date, datetime)):
return text_type(value.isoformat())
if not PY3 and hasattr(value, 'encode'):
return value.encode('utf-8')