Monday, September 27, 2010

Client#post returns None for response

i'm trying to test post request using Client from django.test.client
(v1.1.2) but it returns None for response.
target url is a django-piston resource and i can test it normally from
django shell:
>>> h.request(url, "POST", urlencode(data)) # h is httplib2.Http object

but when i try to use Client#post(url, data) i get this:
------------------------------------------------------------------------
File "/home/aljosa/Projects/Sites/ozujsko.com/env/lib/python2.6/site-packages/django/test/client.py",
line 317, in post
response = self.request(**r)
File "/home/aljosa/Projects/Sites/ozujsko.com/env/lib/python2.6/site-packages/django/test/client.py",
line 225, in request
response = self.handler(environ)
File "/home/aljosa/Projects/Sites/ozujsko.com/env/lib/python2.6/site-packages/django/test/client.py",
line 73, in __call__
response = middleware_method(request, response)
File "/home/aljosa/Projects/Sites/ozujsko.com/env/lib/python2.6/site-packages/django/middleware/common.py",
line 84, in process_response
if response.status_code == 404:
AttributeError: 'NoneType' object has no attribute 'status_code'
------------------------------------------------------------------------

url is relative path (url = "/some/path/") and i can't figure out why
is this happening.
any idea?

Aljosa Mohorovic

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment