diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-29 16:39:25 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-29 16:39:25 +0000 |
| commit | 269e921756371bee6d35a967bc2ffe84d1ae39eb (patch) | |
| tree | fddacb8946dc19376e3425763c8aa4a63b32d00a /django/core/handlers/modpython.py | |
| parent | 3086b55b0e96b82a7f5f7a5c488f97ff5ed76420 (diff) | |
Fixed #9886 -- Added a file-like interface to HttpRequest. Thanks to Ivan Sagalaev for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/handlers/modpython.py')
| -rw-r--r-- | django/core/handlers/modpython.py | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py index 0128f1abe8..7b25f0e11e 100644 --- a/django/core/handlers/modpython.py +++ b/django/core/handlers/modpython.py @@ -42,6 +42,8 @@ class ModPythonRequest(http.HttpRequest): # naughty, but also pretty harmless. self.path_info = u'/' self._post_parse_error = False + self._stream = self._req + self._read_started = False def __repr__(self): # Since this is called as part of error handling, we need to be very @@ -81,26 +83,6 @@ class ModPythonRequest(http.HttpRequest): # mod_python < 3.2.10 doesn't have req.is_https(). return self._req.subprocess_env.get('HTTPS', '').lower() in ('on', '1') - def _load_post_and_files(self): - "Populates self._post and self._files" - if self.method != 'POST': - self._post, self._files = http.QueryDict('', encoding=self._encoding), datastructures.MultiValueDict() - return - - if 'content-type' in self._req.headers_in and self._req.headers_in['content-type'].startswith('multipart'): - self._raw_post_data = '' - try: - self._post, self._files = self.parse_file_upload(self.META, self._req) - except: - # See django.core.handlers.wsgi.WSGIHandler for an explanation - # of what's going on here. - self._post = http.QueryDict('') - self._files = datastructures.MultiValueDict() - self._post_parse_error = True - raise - else: - self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict() - def _get_request(self): if not hasattr(self, '_request'): self._request = datastructures.MergeDict(self.POST, self.GET) @@ -162,13 +144,6 @@ class ModPythonRequest(http.HttpRequest): self._meta[key] = value return self._meta - def _get_raw_post_data(self): - try: - return self._raw_post_data - except AttributeError: - self._raw_post_data = self._req.read() - return self._raw_post_data - def _get_method(self): return self.META['REQUEST_METHOD'].upper() @@ -178,7 +153,6 @@ class ModPythonRequest(http.HttpRequest): FILES = property(_get_files) META = property(_get_meta) REQUEST = property(_get_request) - raw_post_data = property(_get_raw_post_data) method = property(_get_method) class ModPythonHandler(BaseHandler): |
