I am getting the following error:
Traceback (most recent call last):
File "../tests.py", line 92, in test_single_searchfor return_obj in serializers.deserialize("json",response, ensure_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), **options): File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/init.py", line 264, in load return loads(fp.read(), AttributeError: 'HttpResponse' object has no attribute 'read'
In views.py the 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 calling 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 get the above error. Has anyone come across the same error. I am using Django 1.2 (latest version from svn) and it appears to be using the in-built simplejson serializser.