Thursday, July 29, 2010

test's client.post says post but request.method says GET

Django aficionados:

Here's my test code:

from django.test.client import Client
self.client = Client()
from django.core.files.base import ContentFile
file_content = ContentFile(sample_inventory_update_cvs())
file_content.name = 'response.csv'

response = self.client.post( self.url,
data={'csv_file':file_content} )

Disregard all that ContentFile nonsense (unless it's causing the bug).

Inside the action code, I want to distinguish GETting from POSTing.
One paints the page and the other absorbs new form data, as usual.

However, when I print request.method, I get GET.

Is this a bug in Client? or in (ahem) my comprehension?

--
Phlip
http://c2.com/cgi/wiki?ZeekLand

--
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