summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-06-29 18:56:00 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-06-29 18:56:00 +0200
commit74151765073ce280cc5df0bfe411971c6212a0ff (patch)
tree57da2f80648553e0e35aeb0c96420011fac7b996
parentacd7b34aafe352ef604edcb73f75041c5cbba6b9 (diff)
Simplified description of HttpResponse(<iterator>)
Related to 8b9b8d3b.
-rw-r--r--docs/ref/request-response.txt26
1 files changed, 5 insertions, 21 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 578418b4ee..f1c5702d36 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -555,28 +555,12 @@ file-like object::
Passing iterators
~~~~~~~~~~~~~~~~~
-Finally, you can pass ``HttpResponse`` an iterator rather than strings. If you
-use this technique, the iterator should return strings.
+Finally, you can pass ``HttpResponse`` an iterator rather than strings.
+``HttpResponse`` will consume the iterator immediately, store its content as a
+string, and discard it.
-Passing an iterator as content to :class:`HttpResponse` creates a
-streaming response if (and only if) no middleware accesses the
-:attr:`HttpResponse.content` attribute before the response is returned.
-
-.. versionchanged:: 1.5
-
- This technique is fragile and was deprecated in Django 1.5. If you need the
- response to be streamed from the iterator to the client, you should use the
- :class:`StreamingHttpResponse` class instead.
-
- As of Django 1.7, when :class:`HttpResponse` is instantiated with an
- iterator, it will consume it immediately, store the response content as a
- string, and discard the iterator.
-
-.. versionchanged:: 1.5
-
- You can now use :class:`HttpResponse` as a file-like object even if it was
- instantiated with an iterator. Django will consume and save the content of
- the iterator on first access.
+If you need the response to be streamed from the iterator to the client, you
+must use the :class:`StreamingHttpResponse` class instead.
Setting header fields
~~~~~~~~~~~~~~~~~~~~~