Django

Code

Changeset 2786

Show
Ignore:
Timestamp:
04/28/06 21:11:02 (2 years ago)
Author:
adrian
Message:

magic-removal: Proofread docs/request_response.txt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/docs/request_response.txt

    r2744 r2786  
    3737    A dictionary-like object containing all given HTTP POST parameters. See the 
    3838    ``QueryDict`` documentation below. 
     39 
     40    Note: ``POST`` does *not* include file-upload information. See ``FILES``. 
    3941 
    4042``REQUEST`` 
     
    8789 
    8890``user`` 
    89     A ``django.models.auth.users.User`` object representing the currently 
     91    A ``django.contrib.auth.models.User`` object representing the currently 
    9092    logged-in user. If the user isn't currently logged in, ``user`` will be set 
    9193    to an instance of ``django.contrib.auth.models.AnonymousUser``. You 
     
    9799            # Do something for logged-in users. 
    98100 
     101    ``user`` is only available if your Django installation has the 
     102    ``AuthenticationMiddleware`` activated. For more, see 
     103    `Authentication in Web requests`_. 
     104 
     105    .. Authentication in Web requests: http://www.djangoproject.com/documentation/authentication/#authentication-in-web-requests 
     106 
    99107``session`` 
    100108    A readable-and-writable, dictionary-like object that represents the current 
     
    134142of ``django.http.QueryDict``. ``QueryDict`` is a dictionary-like 
    135143class customized to deal with multiple values for the same key. This is 
    136 necessary because some HTML form elements, notably ``<select multiple>``, pass 
    137 multiple values for the same key. 
     144necessary because some HTML form elements, notably 
     145``<select multiple="multiple">``, pass multiple values for the same key. 
    138146 
    139147``QueryDict`` instances are immutable, unless you create a ``copy()`` of them. 
     
    275283----- 
    276284 
     285Passing strings 
     286~~~~~~~~~~~~~~~ 
     287 
    277288Typical usage is to pass the contents of the page, as a string, to the 
    278289``HttpResponse`` constructor:: 
     
    298309Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist. 
    299310 
     311Passing iterators 
     312~~~~~~~~~~~~~~~~~ 
     313 
     314Finally, you can pass ``HttpResponse`` an iterator rather than passing it 
     315hard-coded strings. If you use this technique, follow these guidelines: 
     316 
     317    * The iterator should return strings. 
     318    * If an ``HttpResponse`` has been initialized with an iterator as its 
     319      content, you can't use the ``HttpResponse`` instance as a file-like 
     320      object. Doing so will raise ``Exception``. 
     321 
    300322Methods 
    301323------- 
     
    303325``__init__(content='', mimetype=DEFAULT_MIME_TYPE)`` 
    304326    Instantiates an ``HttpResponse`` object with the given page content (a 
    305     string) and MIME type. The ``DEFAULT_MIME_TYPE`` is ``"text/html"``. 
     327    string) and MIME type. The ``DEFAULT_MIME_TYPE`` is ``'text/html'``. 
    306328 
    307329    ``content`` can be an iterator or a string. If it's an iterator, it should 
     
    361383``HttpResponseRedirect`` 
    362384    The constructor takes a single argument -- the path to redirect to. This 
    363     can be a fully qualified URL (e.g. ``"http://www.yahoo.com/search/"``) or an 
    364     absolute URL with no domain (e.g. ``"/search/"``). Note that this returns 
     385    can be a fully qualified URL (e.g. ``'http://www.yahoo.com/search/'``) or an 
     386    absolute URL with no domain (e.g. ``'/search/'``). Note that this returns 
    365387    an HTTP status code 302. 
    366388