summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorUnai Zalakain <unai@gisa-elkartea.org>2013-11-16 18:54:12 +0100
committerTim Graham <timograham@gmail.com>2014-08-19 17:34:38 -0400
commit5f2542f12a90cfcfb7be776424ef2f7b200df006 (patch)
tree74e78ce1ed7c67e1eb009fcdf8de8e9596361537 /docs
parent9d6551204eff9d1ab70b67578f99630716df7490 (diff)
Fixed #10190 -- Made HttpResponse charset customizable.
Thanks to Simon Charette, Aymeric Augustin, and Tim Graham for reviews and contributions.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/request-response.txt19
-rw-r--r--docs/ref/template-response.txt21
-rw-r--r--docs/releases/1.8.txt3
3 files changed, 40 insertions, 3 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index ba6481107d..339789b2b0 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -627,6 +627,15 @@ Attributes
A bytestring representing the content, encoded from a Unicode
object if necessary.
+.. attribute:: HttpResponse.charset
+
+ .. versionadded:: 1.8
+
+ A string denoting the charset in which the response will be encoded. If not
+ given at ``HttpResponse`` instantiation time, it will be extracted from
+ ``content_type`` and if that is unsuccessful, the
+ :setting:`DEFAULT_CHARSET` setting will be used.
+
.. attribute:: HttpResponse.status_code
The `HTTP status code`_ for the response.
@@ -645,7 +654,7 @@ Attributes
Methods
-------
-.. method:: HttpResponse.__init__(content='', content_type=None, status=200, reason=None)
+.. method:: HttpResponse.__init__(content='', content_type=None, status=200, reason=None, charset=None)
Instantiates an ``HttpResponse`` object with the given page content and
content type.
@@ -666,6 +675,14 @@ Methods
``reason`` is the HTTP response phrase. If not provided, a default phrase
will be used.
+ ``charset`` is the charset in which the response will be encoded. If not
+ given it will be extracted from ``content_type``, and if that
+ is unsuccessful, the :setting:`DEFAULT_CHARSET` setting will be used.
+
+ .. versionadded:: 1.8
+
+ The ``charset`` parameter was added.
+
.. method:: HttpResponse.__setitem__(header, value)
Sets the given header name to the given value. Both ``header`` and
diff --git a/docs/ref/template-response.txt b/docs/ref/template-response.txt
index 36b710426c..7f0ddcf58d 100644
--- a/docs/ref/template-response.txt
+++ b/docs/ref/template-response.txt
@@ -56,7 +56,7 @@ Attributes
Methods
-------
-.. method:: SimpleTemplateResponse.__init__(template, context=None, content_type=None, status=None)
+.. method:: SimpleTemplateResponse.__init__(template, context=None, content_type=None, status=None, charset=None)
Instantiates a
:class:`~django.template.response.SimpleTemplateResponse` object
@@ -80,6 +80,15 @@ Methods
``content_type`` is specified, then its value is used. Otherwise,
:setting:`DEFAULT_CONTENT_TYPE` is used.
+ ``charset``
+ The charset in which the response will be encoded. If not given it will
+ be extracted from ``content_type``, and if that is unsuccessful, the
+ :setting:`DEFAULT_CHARSET` setting will be used.
+
+ .. versionadded:: 1.8
+
+ The ``charset`` parameter was added.
+
.. method:: SimpleTemplateResponse.resolve_context(context)
Converts context data into a context instance that can be used for
@@ -140,7 +149,7 @@ TemplateResponse objects
Methods
-------
-.. method:: TemplateResponse.__init__(request, template, context=None, content_type=None, status=None, current_app=None)
+.. method:: TemplateResponse.__init__(request, template, context=None, content_type=None, status=None, current_app=None, charset=None)
Instantiates an ``TemplateResponse`` object with the given
template, context, MIME type and HTTP status.
@@ -173,6 +182,14 @@ Methods
:ref:`namespaced URL resolution strategy <topics-http-reversing-url-namespaces>`
for more information.
+ ``charset``
+ The charset in which the response will be encoded. If not given it will
+ be extracted from ``content_type``, and if that is unsuccessful, the
+ :setting:`DEFAULT_CHARSET` setting will be used.
+
+ .. versionadded:: 1.8
+
+ The ``charset`` parameter was added.
The rendering process
=====================
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 1f34623811..935893265b 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -278,6 +278,9 @@ Requests and Responses
This brings this class into line with the documentation and with
``WSGIRequest``.
+* The :attr:`HttpResponse.charset <django.http.HttpResponse.charset>` attribute
+ was added.
+
Tests
^^^^^