Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed django.utils.httpwrappers.parse_file_upload() NOT to be coupl…

…ed to mod_python

git-svn-id: http://code.djangoproject.com/svn/django/trunk@165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ac2a7c116dcc0591c5cb55f75b687ef9e8be632e 1 parent f3a43a2
@adrianholovaty adrianholovaty authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 django/utils/httpwrappers.py
View
10 django/utils/httpwrappers.py
@@ -40,7 +40,7 @@ def get_full_path(self):
def _load_post_and_files(self):
"Populates self._post and self._files"
if self._req.headers_in.has_key('content-type') and self._req.headers_in['content-type'].startswith('multipart'):
- self._post, self._files = parse_file_upload(self._req)
+ self._post, self._files = parse_file_upload(self._req.headers_in, self._req.read())
else:
self._post, self._files = QueryDict(self._req.read()), datastructures.MultiValueDict()
@@ -112,12 +112,12 @@ def _get_meta(self):
META = property(_get_meta)
REQUEST = property(_get_request)
-def parse_file_upload(req):
- "Returns a tuple of (POST MultiValueDict, FILES MultiValueDict), given a mod_python req object"
+def parse_file_upload(header_dict, post_data):
+ "Returns a tuple of (POST MultiValueDict, FILES MultiValueDict)"
import email, email.Message
from cgi import parse_header
- raw_message = '\r\n'.join(['%s:%s' % pair for pair in req.headers_in.items()])
- raw_message += '\r\n\r\n' + req.read()
+ raw_message = '\r\n'.join(['%s:%s' % pair for pair in header_dict.items()])
+ raw_message += '\r\n\r\n' + post_data
msg = email.message_from_string(raw_message)
POST = datastructures.MultiValueDict()
FILES = datastructures.MultiValueDict()
Please sign in to comment.
Something went wrong with that request. Please try again.