summaryrefslogtreecommitdiff
path: root/django/core/handlers/modpython.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-08-10 22:12:05 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-08-10 22:12:05 +0000
commitfcfb8edc153a3357529a86aff70ceb273859d7ca (patch)
tree8430b60d178f57b847be79edbeac16aa49e013ee /django/core/handlers/modpython.py
parentbdcea2e6ca383fc6364be63bbf8359ddcd0145a3 (diff)
Fixed #126 -- HttpRequest now has a 'raw_post_data' attribute.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@478 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/handlers/modpython.py')
-rw-r--r--django/core/handlers/modpython.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py
index efc82f0cfd..fafbd10598 100644
--- a/django/core/handlers/modpython.py
+++ b/django/core/handlers/modpython.py
@@ -23,9 +23,9 @@ class ModPythonRequest(httpwrappers.HttpRequest):
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 = httpwrappers.parse_file_upload(self._req.headers_in, self._req.read())
+ self._post, self._files = httpwrappers.parse_file_upload(self._req.headers_in, self.raw_post_data)
else:
- self._post, self._files = httpwrappers.QueryDict(self._req.read()), datastructures.MultiValueDict()
+ self._post, self._files = httpwrappers.QueryDict(self.raw_post_data), datastructures.MultiValueDict()
def _get_request(self):
if not hasattr(self, '_request'):
@@ -88,6 +88,13 @@ class ModPythonRequest(httpwrappers.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 _load_session_and_user(self):
from django.models.auth import sessions
from django.conf.settings import AUTH_SESSION_COOKIE
@@ -122,6 +129,7 @@ class ModPythonRequest(httpwrappers.HttpRequest):
FILES = property(_get_files)
META = property(_get_meta)
REQUEST = property(_get_request)
+ raw_post_data = property(_get_raw_post_data)
session = property(_get_session, _set_session)
user = property(_get_user, _set_user)