summaryrefslogtreecommitdiff
path: root/docs/ref/request-response.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ref/request-response.txt')
-rw-r--r--docs/ref/request-response.txt50
1 files changed, 33 insertions, 17 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index fa8baf0783..b8b08829e9 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -1,5 +1,3 @@
-.. _ref-request-response:
-
============================
Request and response objects
============================
@@ -32,10 +30,25 @@ All attributes except ``session`` should be considered read-only.
.. attribute:: HttpRequest.path
- A string representing the full path to the requested page, not including
- the domain.
+ A string representing the full path to the requested page, not including
+ the domain.
+
+ Example: ``"/music/bands/the_beatles/"``
+
+.. attribute:: HttpRequest.path_info
+
+ Under some web server configurations, the portion of the URL after the host
+ name is split up into a script prefix portion and a path info portion
+ (this happens, for example, when using the ``django.root`` option
+ with the :ref:`modpython handler from Apache <howto-deployment-modpython>`).
+ The ``path_info`` attribute always contains the path info portion of the
+ path, no matter what web server is being used. Using this instead of
+ attr:`~HttpRequest.path` can make your code much easier to move between test
+ and deployment servers.
- Example: ``"/music/bands/the_beatles/"``
+ For example, if the ``django.root`` for your application is set to
+ ``"/minfo"``, then ``path`` might be ``"/minfo/music/bands/the_beatles/"``
+ and ``path_info`` would be ``"/music/bands/the_beatles/"``.
.. attribute:: HttpRequest.method
@@ -106,7 +119,7 @@ All attributes except ``session`` should be considered read-only.
* ``chunks(chunk_size=None)`` -- A generator that yields sequential
chunks of data.
- See :ref:`topics-files` for more information.
+ See :doc:`/topics/files` for more information.
Note that ``FILES`` will only contain data if the request method was POST
and the ``<form>`` that posted to the request had
@@ -165,14 +178,14 @@ All attributes except ``session`` should be considered read-only.
``user`` is only available if your Django installation has the
``AuthenticationMiddleware`` activated. For more, see
- :ref:`topics-auth`.
+ :doc:`/topics/auth`.
.. attribute:: HttpRequest.session
A readable-and-writable, dictionary-like object that represents the current
session. This is only available if your Django installation has session
- support activated. See the :ref:`session documentation
- <topics-http-sessions>` for full details.
+ support activated. See the :doc:`session documentation
+ </topics/http/sessions>` for full details.
.. attribute:: HttpRequest.raw_post_data
@@ -286,7 +299,7 @@ a subclass of dictionary. Exceptions are outlined here:
.. method:: QueryDict.setdefault(key, default)
Just like the standard dictionary ``setdefault()`` method, except it uses
- ``__setitem__`` internally.
+ ``__setitem__()`` internally.
.. method:: QueryDict.update(other_dict)
@@ -305,7 +318,7 @@ a subclass of dictionary. Exceptions are outlined here:
.. method:: QueryDict.items()
Just like the standard dictionary ``items()`` method, except this uses the
- same last-value logic as ``__getitem()__``. For example::
+ same last-value logic as ``__getitem__()``. For example::
>>> q = QueryDict('a=1&a=2&a=3')
>>> q.items()
@@ -315,7 +328,7 @@ a subclass of dictionary. Exceptions are outlined here:
Just like the standard dictionary ``iteritems()`` method. Like
:meth:`QueryDict.items()` this uses the same last-value logic as
- :meth:`QueryDict.__getitem()__`.
+ :meth:`QueryDict.__getitem__()`.
.. method:: QueryDict.iterlists()
@@ -325,7 +338,7 @@ a subclass of dictionary. Exceptions are outlined here:
.. method:: QueryDict.values()
Just like the standard dictionary ``values()`` method, except this uses the
- same last-value logic as ``__getitem()__``. For example::
+ same last-value logic as ``__getitem__()``. For example::
>>> q = QueryDict('a=1&a=2&a=3')
>>> q.values()
@@ -498,11 +511,11 @@ Methods
.. method:: HttpResponse.__delitem__(header)
Deletes the header with the given name. Fails silently if the header
- doesn't exist. Case-sensitive.
+ doesn't exist. Case-insensitive.
.. method:: HttpResponse.__getitem__(header)
- Returns the value for the given header name. Case-sensitive.
+ Returns the value for the given header name. Case-insensitive.
.. method:: HttpResponse.has_header(header)
@@ -516,8 +529,11 @@ Methods
* ``max_age`` should be a number of seconds, or ``None`` (default) if
the cookie should last only as long as the client's browser session.
- * ``expires`` should be a string in the format
- ``"Wdy, DD-Mon-YY HH:MM:SS GMT"``.
+ If ``expires`` is not specified, it will be calculated.
+ * ``expires`` should either be a string in the format
+ ``"Wdy, DD-Mon-YY HH:MM:SS GMT"`` or a ``datetime.datetime`` object
+ in UTC. If ``expires`` is a ``datetime`` object, the ``max_age``
+ will be calculated.
* Use ``domain`` if you want to set a cross-domain cookie. For example,
``domain=".lawrence.com"`` will set a cookie that is readable by
the domains www.lawrence.com, blogs.lawrence.com and