You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
263 B
Python
9 lines
263 B
Python
7 years ago
|
import datetime as dt
|
||
|
import decimal
|
||
|
|
||
|
def alchemyencoder(obj):
|
||
|
"""JSON encoder function for SQLAlchemy special classes."""
|
||
|
if isinstance(obj, dt.datetime):
|
||
|
return obj.isoformat()
|
||
|
elif isinstance(obj, decimal.Decimal):
|
||
|
return float(obj)
|