if the object is a decimal, return the string representation of it.

This commit is contained in:
Brian Painter
2016-03-23 08:21:36 -04:00
parent a5b1f7987e
commit 9fdb72cc5c
+8 -1
View File
@@ -2,6 +2,7 @@
""" Tablib - JSON Support
"""
import decimal
import tablib
@@ -14,7 +15,13 @@ extensions = ('json', 'jsn')
def date_handler(obj):
return obj.isoformat() if hasattr(obj, 'isoformat') else obj
if isinstance(obj, decimal.Decimal):
return str(obj)
elif hasattr(obj, 'isoformat'):
return obj.isoformat()
else:
return obj
# return obj.isoformat() if hasattr(obj, 'isoformat') else obj
def export_set(dataset):