handle date.isoformat separately, refs #117
This commit is contained in:
parent
bdcd371b5a
commit
e5c1aa31b4
@ -8,7 +8,7 @@ from dataset.freeze.format.common import Serializer
|
|||||||
|
|
||||||
|
|
||||||
def value_to_str(value):
|
def value_to_str(value):
|
||||||
if isinstance(value, (datetime, date)):
|
if isinstance(value, datetime):
|
||||||
#
|
#
|
||||||
# FIXME: this check does not work for values returned from a db query!
|
# 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
|
# As a workaround, we make sure, the isoformat call returns the regular
|
||||||
@ -16,6 +16,8 @@ def value_to_str(value):
|
|||||||
#
|
#
|
||||||
sep = ' ' if PY3 else str(' ')
|
sep = ' ' if PY3 else str(' ')
|
||||||
return text_type(value.isoformat(sep=sep))
|
return text_type(value.isoformat(sep=sep))
|
||||||
|
if isinstance(value, date):
|
||||||
|
return text_type(value.isoformat())
|
||||||
if not PY3 and hasattr(value, 'encode'):
|
if not PY3 and hasattr(value, 'encode'):
|
||||||
return value.encode('utf-8')
|
return value.encode('utf-8')
|
||||||
if value is None:
|
if value is None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user