Anonymous avatar Anonymous committed 66a8d7b

magic-removal: Proofread docs/request_response.txt

Comments (0)

Files changed (1)

docs/request_response.txt

     A dictionary-like object containing all given HTTP POST parameters. See the
     ``QueryDict`` documentation below.
 
+    Note: ``POST`` does *not* include file-upload information. See ``FILES``.
+
 ``REQUEST``
     For convenience, a dictionary-like object that searches ``POST`` first,
     then ``GET``. Inspired by PHP's ``$_REQUEST``.
         * ``SERVER_PORT`` -- The port of the server.
 
 ``user``
-    A ``django.models.auth.users.User`` object representing the currently
+    A ``django.contrib.auth.models.User`` object representing the currently
     logged-in user. If the user isn't currently logged in, ``user`` will be set
     to an instance of ``django.contrib.auth.models.AnonymousUser``. You
     can tell them apart with ``is_anonymous()``, like so::
         else:
             # Do something for logged-in users.
 
+    ``user`` is only available if your Django installation has the
+    ``AuthenticationMiddleware`` activated. For more, see
+    `Authentication in Web requests`_.
+
+    .. Authentication in Web requests: http://www.djangoproject.com/documentation/authentication/#authentication-in-web-requests
+
 ``session``
     A readable-and-writable, dictionary-like object that represents the current
     session. This is only available if your Django installation has session
 In an ``HttpRequest`` object, the ``GET`` and ``POST`` attributes are instances
 of ``django.http.QueryDict``. ``QueryDict`` is a dictionary-like
 class customized to deal with multiple values for the same key. This is
-necessary because some HTML form elements, notably ``<select multiple>``, pass
-multiple values for the same key.
+necessary because some HTML form elements, notably
+``<select multiple="multiple">``, pass multiple values for the same key.
 
 ``QueryDict`` instances are immutable, unless you create a ``copy()`` of them.
 That means you can't change attributes of ``request.POST`` and ``request.GET``
 Usage
 -----
 
+Passing strings
+~~~~~~~~~~~~~~~
+
 Typical usage is to pass the contents of the page, as a string, to the
 ``HttpResponse`` constructor::
 
 
 Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist.
 
+Passing iterators
+~~~~~~~~~~~~~~~~~
+
+Finally, you can pass ``HttpResponse`` an iterator rather than passing it
+hard-coded strings. If you use this technique, follow these guidelines:
+
+    * The iterator should return strings.
+    * If an ``HttpResponse`` has been initialized with an iterator as its
+      content, you can't use the ``HttpResponse`` instance as a file-like
+      object. Doing so will raise ``Exception``.
+
 Methods
 -------
 
 ``__init__(content='', mimetype=DEFAULT_MIME_TYPE)``
     Instantiates an ``HttpResponse`` object with the given page content (a
-    string) and MIME type. The ``DEFAULT_MIME_TYPE`` is ``"text/html"``.
+    string) and MIME type. The ``DEFAULT_MIME_TYPE`` is ``'text/html'``.
 
     ``content`` can be an iterator or a string. If it's an iterator, it should
     return strings, and those strings will be joined together to form the
 
 ``HttpResponseRedirect``
     The constructor takes a single argument -- the path to redirect to. This
-    can be a fully qualified URL (e.g. ``"http://www.yahoo.com/search/"``) or an
-    absolute URL with no domain (e.g. ``"/search/"``). Note that this returns
+    can be a fully qualified URL (e.g. ``'http://www.yahoo.com/search/'``) or an
+    absolute URL with no domain (e.g. ``'/search/'``). Note that this returns
     an HTTP status code 302.
 
 ``HttpResponsePermanentRedirect``
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.