|
@@ -34,12 +34,12 @@
|
|
|
# This is frustrating visually, since the JSON ends up double-quoted.
|
|
# This is frustrating visually, since the JSON ends up double-quoted.
|
|
|
# It also means that you have to dirty your object with an extra __unicode__
|
|
# It also means that you have to dirty your object with an extra __unicode__
|
|
|
# field. You can do it, like so:
|
|
# field. You can do it, like so:
|
|
|
-# tft.__unicode__ = lambda: simplejson.dumps(thrift_util.thrift2json(tft))
|
|
|
|
|
|
|
+# tft.__unicode__ = lambda: json.dumps(thrift_util.thrift2json(tft))
|
|
|
# but then your field is no longer equal to a Thrift object that hasn't
|
|
# but then your field is no longer equal to a Thrift object that hasn't
|
|
|
# been through this dirtying, and that's bad.
|
|
# been through this dirtying, and that's bad.
|
|
|
# So, don't use JSON serialization, and use XML serialization instead.
|
|
# So, don't use JSON serialization, and use XML serialization instead.
|
|
|
|
|
|
|
|
-import simplejson
|
|
|
|
|
|
|
+import json
|
|
|
|
|
|
|
|
import thrift_util
|
|
import thrift_util
|
|
|
|
|
|
|
@@ -69,7 +69,7 @@ class ThriftField(models.TextField):
|
|
|
if not isinstance(value, basestring):
|
|
if not isinstance(value, basestring):
|
|
|
return value
|
|
return value
|
|
|
|
|
|
|
|
- jsonable = simplejson.loads(value)
|
|
|
|
|
|
|
+ jsonable = json.loads(value)
|
|
|
tft = thrift_util.jsonable2thrift(jsonable, self.thrift_class)
|
|
tft = thrift_util.jsonable2thrift(jsonable, self.thrift_class)
|
|
|
return tft
|
|
return tft
|
|
|
|
|
|
|
@@ -77,14 +77,13 @@ class ThriftField(models.TextField):
|
|
|
if value is None:
|
|
if value is None:
|
|
|
return None
|
|
return None
|
|
|
jsonable = thrift_util.thrift2json(value)
|
|
jsonable = thrift_util.thrift2json(value)
|
|
|
- json = simplejson.dumps(jsonable)
|
|
|
|
|
- return json
|
|
|
|
|
|
|
+ return json.dumps(jsonable)
|
|
|
|
|
|
|
|
def value_to_string(self, obj):
|
|
def value_to_string(self, obj):
|
|
|
"""
|
|
"""
|
|
|
Used by XML serialization.
|
|
Used by XML serialization.
|
|
|
"""
|
|
"""
|
|
|
- return simplejson.dumps(thrift_util.thrift2json(self._get_val_from_obj(obj)))
|
|
|
|
|
|
|
+ return json.dumps(thrift_util.thrift2json(self._get_val_from_obj(obj)))
|
|
|
|
|
|
|
|
|
|
|
|
|
# See http://south.aeracode.org/docs/customfields.html#extending-introspection
|
|
# See http://south.aeracode.org/docs/customfields.html#extending-introspection
|