Merge pull request #234 from BrianPainter/master

if the object is a decimal, return the string representation of it.
This commit is contained in:
Iuri de Silvio
2016-12-18 19:10:18 -02:00
committed by GitHub
+8 -1
View File
@@ -2,6 +2,7 @@
""" Tablib - JSON Support
"""
import decimal
import tablib
@@ -16,7 +17,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):