mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Liverpool 4 Barcelona 0
This commit is contained in:
parent
7aa7f8f746
commit
f42c1b5ed3
33
monkey.py
33
monkey.py
@ -1,19 +1,32 @@
|
||||
# custom json encoding
|
||||
|
||||
# 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)
|
||||
return getattr(object.__class__,"__json__", self._olddefault)(object)
|
||||
|
||||
olddefault = JSONEncoder.default
|
||||
|
||||
# just patch every encoder
|
||||
try:
|
||||
from simplejson import JSONEncoder
|
||||
JSONEncoder._olddefault = JSONEncoder.default
|
||||
JSONEncoder.default = newdefault
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
from json import JSONEncoder
|
||||
JSONEncoder._olddefault = JSONEncoder.default
|
||||
JSONEncoder.default = newdefault
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
from ujson import JSONEncoder
|
||||
JSONEncoder._olddefault = JSONEncoder.default
|
||||
JSONEncoder.default = newdefault
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user