Hi all, i have to replace a php-script with a django-view. The django-view just get some Post-Data and a file. The view works fine. Now, i want to write a test for the upload. My Script looks like this:
from django.test.client import Client from django.test import client c = Client() file = open('tests/2008_05_29_0000.row', 'r') f = client.encode_file(client.MULTIPART_CONTENT, 'File', file) file.close() response = c.post('/ammonit/upload.php', {'loggercode': '999999', 'File' : f}) Inside of the view, i have some lines like this (i use python logging): logging.fatal('request.POST: ' + str(request.POST)) logging.fatal('request.FILES: ' + str(request.FILES)) My Logfile now shows me the following: CRITICAL request.POST: <QueryDict: {u'loggercode': [u'999999'], u'File': [u'--multipart/form-data; boundary=BoUnDaRyStRiNg', u'Content-Disposition: form-data; name="File"; filename="2008_05_29_0000.row"', u'Content-Type: application/octet-stream', u'', u'T 05/29 ............... The Variable request.FILES is empty. So the File is in request.POST. Anybody knows why the file is not in request.FILES ? Cheers, Tom --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---