Loading django/core/handlers/modpython.py +4 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,9 @@ class ModPythonRequest(http.HttpRequest): self._raw_post_data = self._req.read() return self._raw_post_data def _get_method(self): return self.META['REQUEST_METHOD'].upper() GET = property(_get_get, _set_get) POST = property(_get_post, _set_post) COOKIES = property(_get_cookies, _set_cookies) Loading @@ -105,6 +108,7 @@ class ModPythonRequest(http.HttpRequest): META = property(_get_meta) REQUEST = property(_get_request) raw_post_data = property(_get_raw_post_data) method = property(_get_method) class ModPythonHandler(BaseHandler): def __call__(self, req): Loading django/core/handlers/wsgi.py +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ class WSGIRequest(http.HttpRequest): self.environ = environ self.path = environ['PATH_INFO'] self.META = environ self.method = environ['REQUEST_METHOD'].upper() def __repr__(self): from pprint import pformat Loading django/http/__init__.py +3 −2 Original line number Diff line number Diff line Loading @@ -12,11 +12,12 @@ except ImportError: class Http404(Exception): pass class HttpRequest(object): # needs to be new-style class because subclasses define "property"s class HttpRequest(object): "A basic HTTP request" def __init__(self): self.GET, self.POST, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {} self.path = '' self.method = None def __repr__(self): return '<HttpRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \ Loading Loading @@ -282,7 +283,7 @@ class HttpResponseServerError(HttpResponse): self.status_code = 500 def get_host(request): """Gets the HTTP host from the environment or request headers.""" "Gets the HTTP host from the environment or request headers." host = request.META.get('HTTP_X_FORWARDED_HOST', '') if not host: host = request.META.get('HTTP_HOST', '') Loading docs/request_response.txt +14 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,15 @@ All attributes except ``session`` should be considered read-only. Example: ``"/music/bands/the_beatles/"`` ``method`` A string representing the HTTP method used in the request. This is guaranteed to be uppercase. Example:: if request.method == 'GET': do_something() elif request.method == 'POST': do_something_else() ``GET`` A dictionary-like object containing all given HTTP GET parameters. See the ``QueryDict`` documentation below. Loading @@ -37,6 +46,11 @@ All attributes except ``session`` should be considered read-only. A dictionary-like object containing all given HTTP POST parameters. See the ``QueryDict`` documentation below. It's possible that a request can come in via POST with an empty ``POST`` dictionary -- if, say, a form is requested via the POST HTTP method but does not include form data. Therefore, you shouldn't use ``if request.POST`` to check for use of the POST method; instead, check `method`_. Note: ``POST`` does *not* include file-upload information. See ``FILES``. ``REQUEST`` Loading Loading
django/core/handlers/modpython.py +4 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,9 @@ class ModPythonRequest(http.HttpRequest): self._raw_post_data = self._req.read() return self._raw_post_data def _get_method(self): return self.META['REQUEST_METHOD'].upper() GET = property(_get_get, _set_get) POST = property(_get_post, _set_post) COOKIES = property(_get_cookies, _set_cookies) Loading @@ -105,6 +108,7 @@ class ModPythonRequest(http.HttpRequest): META = property(_get_meta) REQUEST = property(_get_request) raw_post_data = property(_get_raw_post_data) method = property(_get_method) class ModPythonHandler(BaseHandler): def __call__(self, req): Loading
django/core/handlers/wsgi.py +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ class WSGIRequest(http.HttpRequest): self.environ = environ self.path = environ['PATH_INFO'] self.META = environ self.method = environ['REQUEST_METHOD'].upper() def __repr__(self): from pprint import pformat Loading
django/http/__init__.py +3 −2 Original line number Diff line number Diff line Loading @@ -12,11 +12,12 @@ except ImportError: class Http404(Exception): pass class HttpRequest(object): # needs to be new-style class because subclasses define "property"s class HttpRequest(object): "A basic HTTP request" def __init__(self): self.GET, self.POST, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {} self.path = '' self.method = None def __repr__(self): return '<HttpRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \ Loading Loading @@ -282,7 +283,7 @@ class HttpResponseServerError(HttpResponse): self.status_code = 500 def get_host(request): """Gets the HTTP host from the environment or request headers.""" "Gets the HTTP host from the environment or request headers." host = request.META.get('HTTP_X_FORWARDED_HOST', '') if not host: host = request.META.get('HTTP_HOST', '') Loading
docs/request_response.txt +14 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,15 @@ All attributes except ``session`` should be considered read-only. Example: ``"/music/bands/the_beatles/"`` ``method`` A string representing the HTTP method used in the request. This is guaranteed to be uppercase. Example:: if request.method == 'GET': do_something() elif request.method == 'POST': do_something_else() ``GET`` A dictionary-like object containing all given HTTP GET parameters. See the ``QueryDict`` documentation below. Loading @@ -37,6 +46,11 @@ All attributes except ``session`` should be considered read-only. A dictionary-like object containing all given HTTP POST parameters. See the ``QueryDict`` documentation below. It's possible that a request can come in via POST with an empty ``POST`` dictionary -- if, say, a form is requested via the POST HTTP method but does not include form data. Therefore, you shouldn't use ``if request.POST`` to check for use of the POST method; instead, check `method`_. Note: ``POST`` does *not* include file-upload information. See ``FILES``. ``REQUEST`` Loading