1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

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

View File

@ -1,6 +1,13 @@
# custom json encoding # 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): def newdefault(self,object):
return getattr(object.__class__,"__json__", olddefault)(object) return getattr(object.__class__,"__json__", olddefault)(object)