summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-08-11 09:37:42 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-08-11 09:37:42 +0000
commit0afbca9c60206d5005243cb961ff813f2cd6dbf3 (patch)
tree3d9be4ec8ed50da5aae08b6f89bc5a396904e69c /docs
parent6fd2c25addcf49f989ced81060b40533d9f6e9ed (diff)
Fixed #3526 -- Added content_type as an alias for mimetype to the HttpResponse constructor. It's a slightly more accurate name. Based on a patch from Simon Willison. Fully backwards compatible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5844 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/request_response.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/request_response.txt b/docs/request_response.txt
index a17a60ff17..826065981b 100644
--- a/docs/request_response.txt
+++ b/docs/request_response.txt
@@ -342,7 +342,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 +350,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 +406,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
-----------------------