Now actually patching the JSON encoder bottle uses

This commit is contained in:
Krateng 2019-05-08 18:31:48 +02:00
parent 490f6f9f99
commit 7aa7f8f746
1 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,13 @@
# custom json encoding
from simplejson import JSONEncoder
# make sure we use the json encoder that bottle uses
try:
from simplejson import JSONEncoder
except ImportError:
try:
from json import JSONEncoder
except ImportError:
from django.utils.simplejson import JSONEncoder
def newdefault(self,object):
return getattr(object.__class__,"__json__", olddefault)(object)