Changeset 3164
- Timestamp:
- 06/19/06 22:48:31 (2 years ago)
- Files:
-
- django/trunk/django/core/handlers/modpython.py (modified) (2 diffs)
- django/trunk/django/core/handlers/wsgi.py (modified) (1 diff)
- django/trunk/django/http/__init__.py (modified) (2 diffs)
- django/trunk/docs/request_response.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/handlers/modpython.py
r2809 r3164 99 99 return self._raw_post_data 100 100 101 def _get_method(self): 102 return self.META['REQUEST_METHOD'].upper() 103 101 104 GET = property(_get_get, _set_get) 102 105 POST = property(_get_post, _set_post) … … 106 109 REQUEST = property(_get_request) 107 110 raw_post_data = property(_get_raw_post_data) 111 method = property(_get_method) 108 112 109 113 class ModPythonHandler(BaseHandler): django/trunk/django/core/handlers/wsgi.py
r2809 r3164 56 56 self.path = environ['PATH_INFO'] 57 57 self.META = environ 58 self.method = environ['REQUEST_METHOD'].upper() 58 59 59 60 def __repr__(self): django/trunk/django/http/__init__.py
r3144 r3164 13 13 pass 14 14 15 class HttpRequest(object): # needs to be new-style class because subclasses define "property"s15 class HttpRequest(object): 16 16 "A basic HTTP request" 17 17 def __init__(self): 18 18 self.GET, self.POST, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {} 19 19 self.path = '' 20 self.method = None 20 21 21 22 def __repr__(self): … … 283 284 284 285 def get_host(request): 285 " ""Gets the HTTP host from the environment or request headers."""286 "Gets the HTTP host from the environment or request headers." 286 287 host = request.META.get('HTTP_X_FORWARDED_HOST', '') 287 288 if not host: django/trunk/docs/request_response.txt
r3144 r3164 30 30 Example: ``"/music/bands/the_beatles/"`` 31 31 32 ``method`` 33 A string representing the HTTP method used in the request. This is 34 guaranteed to be uppercase. Example:: 35 36 if request.method == 'GET': 37 do_something() 38 elif request.method == 'POST': 39 do_something_else() 40 32 41 ``GET`` 33 42 A dictionary-like object containing all given HTTP GET parameters. See the … … 37 46 A dictionary-like object containing all given HTTP POST parameters. See the 38 47 ``QueryDict`` documentation below. 48 49 It's possible that a request can come in via POST with an empty ``POST`` 50 dictionary -- if, say, a form is requested via the POST HTTP method but 51 does not include form data. Therefore, you shouldn't use ``if request.POST`` 52 to check for use of the POST method; instead, check `method`_. 39 53 40 54 Note: ``POST`` does *not* include file-upload information. See ``FILES``.
