1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #16494 by normalizing HttpResponse behavior with non-string input. HttpResponse now always converts content to string on output, regardless of input type.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16829 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Paul McMillan
2011-09-14 23:27:35 +00:00
parent 67e05fcd39
commit 50255e3305
3 changed files with 65 additions and 19 deletions

View File

@@ -587,7 +587,7 @@ Attributes
.. attribute:: HttpResponse.content
A normal Python string representing the content, encoded from a Unicode
A string representing the content, encoded from a Unicode
object if necessary.
.. attribute:: HttpResponse.status_code
@@ -603,9 +603,11 @@ Methods
string) and MIME type. The :setting:`DEFAULT_CONTENT_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
content of the response.
``content`` should 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 content of the response. If it is not
an iterator or a string, it will be converted to a string when
accessed.
``status`` is the `HTTP Status code`_ for the response.