Multipart form problems with PyISAPIe and Django
Created 2008-08-28T13:40:36.781Z, last edited 2008-08-28T14:08:53.967Z
Fairly recently Django changed the way that POST data was parsed — at least when multipart POST data is submitted (required for file uploads). PyISAPIe needs a small tweak in order for it to work with the new API.
The change that is needed is in django.core.handlers.pyisapie.PyISAPIeRequest._load_post_and_files()
. It should read:
def _load_post_and_files(This):
"Populates This._post and This._files"
Ctype = Env.HTTP_CONTENT_TYPE or ''
if Ctype.startswith('multipart'):
import StringIO
This._post , This._files = http.HttpRequest.parse_file_upload(This, This.META, StringIO.StringIO(This.raw_post_data))
else:
This._post, This._files = http.QueryDict(This.raw_post_data), datastructures.MultiValueDict()
Rather surprisingly this took me about 4 hours to write, partly due to a load of incorrect comments in django.http.multipartparser.py
about which I'm going to post a ticket and a patch (which hopefully might make it in before release).
© 2002-2025 Kirit & Tai Sælensminde. All forum posts are copyright their respective authors.
Licensed under a Creative Commons License. Non-commercial use is fine so long as you provide attribution.