Fixed an simplejson deprecation, switching to python json.
This commit is contained in:
parent
972e47e66c
commit
ec54de4797
1 changed files with 3 additions and 3 deletions
|
|
@ -17,11 +17,11 @@ found on http://localhost:8000/webclient.)
|
||||||
to sessions connected over the webclient.
|
to sessions connected over the webclient.
|
||||||
"""
|
"""
|
||||||
import time
|
import time
|
||||||
|
import json
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
|
||||||
from twisted.web import server, resource
|
from twisted.web import server, resource
|
||||||
|
|
||||||
from django.utils import simplejson
|
|
||||||
from django.utils.functional import Promise
|
from django.utils.functional import Promise
|
||||||
from django.utils.encoding import force_unicode
|
from django.utils.encoding import force_unicode
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
@ -38,7 +38,7 @@ ENCODINGS = settings.ENCODINGS
|
||||||
# extend this if one wants to send more
|
# extend this if one wants to send more
|
||||||
# complex database objects too.
|
# complex database objects too.
|
||||||
|
|
||||||
class LazyEncoder(simplejson.JSONEncoder):
|
class LazyEncoder(json.JSONEncoder):
|
||||||
def default(self, obj):
|
def default(self, obj):
|
||||||
if isinstance(obj, Promise):
|
if isinstance(obj, Promise):
|
||||||
return force_unicode(obj)
|
return force_unicode(obj)
|
||||||
|
|
@ -46,7 +46,7 @@ class LazyEncoder(simplejson.JSONEncoder):
|
||||||
|
|
||||||
|
|
||||||
def jsonify(obj):
|
def jsonify(obj):
|
||||||
return utils.to_str(simplejson.dumps(obj, ensure_ascii=False, cls=LazyEncoder))
|
return utils.to_str(json.dumps(obj, ensure_ascii=False, cls=LazyEncoder))
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue