Changeset 8202
- Timestamp:
- 08/03/08 14:55:26 (4 months ago)
- Files:
-
- django/trunk/django/http/__init__.py (modified) (1 diff)
- django/trunk/docs/request_response.txt (modified) (1 diff)
- django/trunk/tests/regressiontests/context_processors (added)
- django/trunk/tests/regressiontests/context_processors/__init__.py (added)
- django/trunk/tests/regressiontests/context_processors/models.py (added)
- django/trunk/tests/regressiontests/context_processors/templates (added)
- django/trunk/tests/regressiontests/context_processors/templates/context_processors (added)
- django/trunk/tests/regressiontests/context_processors/templates/context_processors/request_attrs.html (added)
- django/trunk/tests/regressiontests/context_processors/tests.py (added)
- django/trunk/tests/regressiontests/context_processors/urls.py (added)
- django/trunk/tests/regressiontests/context_processors/views.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/http/__init__.py
r8015 r8202 39 39 (pformat(self.GET), pformat(self.POST), pformat(self.COOKIES), 40 40 pformat(self.META)) 41 42 def __getitem__(self, key):43 for d in (self.POST, self.GET):44 if key in d:45 return d[key]46 raise KeyError, "%s not found in either POST or GET" % key47 48 def has_key(self, key):49 return key in self.GET or key in self.POST50 51 __contains__ = has_key52 41 53 42 def get_host(self): django/trunk/docs/request_response.txt
r7814 r8202 171 171 ------- 172 172 173 ``__getitem__(key)``174 Returns the GET/POST value for the given key, checking POST first, then175 GET. Raises ``KeyError`` if the key doesn't exist.176 177 This lets you use dictionary-accessing syntax on an ``HttpRequest``178 instance. Example: ``request["foo"]`` would return ``True`` if either179 ``request.POST`` or ``request.GET`` had a ``"foo"`` key.180 181 ``has_key()``182 Returns ``True`` or ``False``, designating whether ``request.GET`` or183 ``request.POST`` has the given key.184 185 173 ``get_host()`` 186 174 **New in Django development version**
