Fixed an simplejson deprecation, switching to python json.

This commit is contained in:
Griatch 2014-04-20 16:50:37 +02:00
parent 972e47e66c
commit ec54de4797

View file

@ -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))
# #