Jessie deserialization
I am getting the following error:
Traceback (last call last):
File "../tests.py", line 92, in test_single_searchfor return_obj in serializers.deserialize ("json", response, secure_ascii = False):
File "/Library/Python/2.6/site-packages/django/core/serializers/json.py", line 38, in Deserializer for obj in PythonDeserializer (simplejson.load (stream), **): File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/ the init .py", line 264, in return load load (fp.read (), AttributeError: HttpResponse object has no 'read' attribute
In views.py, serialization works correctly:
resultsjson = serializers.serialize("json", results, ensure_ascii=False)
return HttpResponse(resultsjson, mimetype = 'application/json')
However, when I try to process the result in my call method in test.py:
response = self.client.get("/path/?query=testValue")
for return_obj in serializers.deserialize("json", response, ensure_ascii=False):
print return_obj
I am getting the above error. Has anyone encountered the same error. I am using Django 1.2 (latest version from svn) and it seems to be using the built-in serialjser simplejson.
a source to share