Support Decimal in PYSONEncoder
issue7291 review46341002
This commit is contained in:
1 parent
c8896c1efb
commit
088627dcd2
1 file changed
+3
@@ -2,6 +2,7 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import json
|
||||
import datetime
|
||||
from decimal import Decimal
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from functools import reduce, wraps
|
||||
|
||||
@@ -117,6 +118,8 @@ class PYSONEncoder(json.JSONEncoder):
|
||||
).pyson()
|
||||
else:
|
||||
return Date(obj.year, obj.month, obj.day).pyson()
|
||||
elif isinstance(obj, Decimal):
|
||||
return float(obj)
|
||||
return super(PYSONEncoder, self).default(obj)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user