diff options
| author | Justin Bronn <jbronn@gmail.com> | 2007-08-26 01:10:53 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2007-08-26 01:10:53 +0000 |
| commit | 2052b508eb92c62fc0678efd4936c5ec1e0e735b (patch) | |
| tree | e510109b74b28c8ccef5f6955727cb9dce3da655 /docs/request_response.txt | |
| parent | a7297a255f4bb86f608ea251e00253d18c31d9d4 (diff) | |
gis: Made necessary modifications for unicode, manage refactor, backend refactor and merged 5584-6000 via svnmerge from [repos:django/trunk trunk].
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/request_response.txt')
| -rw-r--r-- | docs/request_response.txt | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/docs/request_response.txt b/docs/request_response.txt index 0b985d563b..867464226a 100644 --- a/docs/request_response.txt +++ b/docs/request_response.txt @@ -38,6 +38,16 @@ All attributes except ``session`` should be considered read-only. elif request.method == 'POST': do_something_else() +``encoding`` + **New in Django development version** + + A string representing the current encoding used to decode form submission + data (or ``None``, which means the ``DEFAULT_CHARSET`` setting is used). + You can write to this attribute to change the encoding used when accessing + the form data. Any subsequent attribute accesses (such as reading from + ``GET`` or ``POST``) will use the new ``encoding`` value. Useful if you + know the form data is not in the ``DEFAULT_CHARSET`` encoding. + ``GET`` A dictionary-like object containing all given HTTP GET parameters. See the ``QueryDict`` documentation below. @@ -297,7 +307,7 @@ In contrast to ``HttpRequest`` objects, which are created automatically by Django, ``HttpResponse`` objects are your responsibility. Each view you write is responsible for instantiating, populating and returning an ``HttpResponse``. -The ``HttpResponse`` class lives at ``django.http.HttpResponse``. +The ``HttpResponse`` class lives in the ``django.http`` module. Usage ----- @@ -342,7 +352,7 @@ hard-coded strings. If you use this technique, follow these guidelines: Methods ------- -``__init__(content='', mimetype=DEFAULT_CONTENT_TYPE)`` +``__init__(content='', mimetype=None, status=200, content_type=DEFAULT_CONTENT_TYPE)`` Instantiates an ``HttpResponse`` object with the given page content (a string) and MIME type. The ``DEFAULT_CONTENT_TYPE`` is ``'text/html'``. @@ -350,6 +360,16 @@ Methods return strings, and those strings will be joined together to form the content of the response. + ``status`` is the `HTTP Status code`_ for the response. + + **(New in Django development version)** ``content_type`` is an alias for + ``mimetype``. Historically, the parameter was only called ``mimetype``, + but since this is actually the value included in the HTTP ``Content-Type`` + header, it can also include the character set encoding, which makes it + more than just a MIME type specification. If ``mimetype`` is specifiedi + (not None), that value is used. Otherwise, ``content_type`` is used. If + neither is given, the ``DEFAULT_CONTENT_TYPE`` setting is used. + ``__setitem__(header, value)`` Sets the given header name to the given value. Both ``header`` and ``value`` should be strings. @@ -396,6 +416,8 @@ Methods ``write(content)``, ``flush()`` and ``tell()`` These methods make an ``HttpResponse`` instance a file-like object. +.. _HTTP Status code: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 + HttpResponse subclasses ----------------------- |
