Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplified description of HttpResponse(<iterator>)

Related to 8b9b8d3.
  • Loading branch information...
commit 74151765073ce280cc5df0bfe411971c6212a0ff 1 parent acd7b34
Aymeric Augustin authored June 29, 2013

Showing 1 changed file with 5 additions and 21 deletions. Show diff stats Hide diff stats

  1. 26  docs/ref/request-response.txt
26  docs/ref/request-response.txt
@@ -555,28 +555,12 @@ file-like object::
555 555
 Passing iterators
556 556
 ~~~~~~~~~~~~~~~~~
557 557
 
558  
-Finally, you can pass ``HttpResponse`` an iterator rather than strings. If you
559  
-use this technique, the iterator should return strings.
  558
+Finally, you can pass ``HttpResponse`` an iterator rather than strings.
  559
+``HttpResponse`` will consume the iterator immediately, store its content as a
  560
+string, and discard it.
560 561
 
561  
-Passing an iterator as content to :class:`HttpResponse` creates a
562  
-streaming response if (and only if) no middleware accesses the
563  
-:attr:`HttpResponse.content` attribute before the response is returned.
564  
-
565  
-.. versionchanged:: 1.5
566  
-
567  
-    This technique is fragile and was deprecated in Django 1.5. If you need the
568  
-    response to be streamed from the iterator to the client, you should use the
569  
-    :class:`StreamingHttpResponse` class instead.
570  
-
571  
-    As of Django 1.7, when :class:`HttpResponse` is instantiated with an
572  
-    iterator, it will consume it immediately, store the response content as a
573  
-    string, and discard the iterator.
574  
-
575  
-.. versionchanged:: 1.5
576  
-
577  
-    You can now use :class:`HttpResponse` as a file-like object even if it was
578  
-    instantiated with an iterator. Django will consume and save the content of
579  
-    the iterator on first access.
  562
+If you need the response to be streamed from the iterator to the client, you
  563
+must use the :class:`StreamingHttpResponse` class instead.
580 564
 
581 565
 Setting header fields
582 566
 ~~~~~~~~~~~~~~~~~~~~~

0 notes on commit 7415176

Please sign in to comment.
Something went wrong with that request. Please try again.