summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMichael Kelly <mkelly@mozilla.com>2014-04-14 11:58:59 -0400
committerTim Graham <timograham@gmail.com>2014-11-03 12:29:19 -0500
commitebc8e79cf3bdd42a99e91d6e679248d07097d3db (patch)
tree4c4a59eb2a00372efc7ac0794e5fd6f12a635a39 /docs
parentf7969b0920c403118656f6bfec58d6454d79ef1a (diff)
Fixed #18523 -- Added stream-like API to HttpResponse.
Added getvalue() to HttpResponse to return the content of the response, along with a few other methods to partially match io.IOBase. Thanks Claude Paroz for the suggestion and Nick Sanford for review.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/request-response.txt27
-rw-r--r--docs/releases/1.8.txt4
2 files changed, 31 insertions, 0 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 2a43756889..a86f416620 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -651,6 +651,12 @@ Attributes
This attribute exists so middleware can treat streaming responses
differently from regular responses.
+.. attribute:: HttpResponse.closed
+
+ .. versionadded:: 1.8
+
+ ``True`` if the response has been closed.
+
Methods
-------
@@ -769,6 +775,27 @@ Methods
This method makes an :class:`HttpResponse` instance a file-like object.
+.. method:: HttpResponse.getvalue()
+
+ .. versionadded:: 1.8
+
+ Returns the value of :attr:`HttpResponse.content`. This method makes
+ an :class:`HttpResponse` instance a stream-like object.
+
+.. method:: HttpResponse.writable()
+
+ .. versionadded:: 1.8
+
+ Always ``True``. This method makes an :class:`HttpResponse` instance a
+ stream-like object.
+
+.. method:: HttpResponse.writelines(lines)
+
+ .. versionadded:: 1.8
+
+ Writes a list of lines to the response. Line seperators are not added. This
+ method makes an :class:`HttpResponse` instance a stream-like object.
+
.. _HTTP status code: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10
.. _ref-httpresponse-subclasses:
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 492fad478f..00a2c9844c 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -385,6 +385,10 @@ Requests and Responses
<django.http.HttpRequest.get_full_path>` method now escapes unsafe characters
from the path portion of a Uniform Resource Identifier (URI) properly.
+* :class:`~django.http.HttpResponse` now implements a few additional methods
+ like :meth:`~django.http.HttpResponse.getvalue` so that instances can be used
+ as stream objects.
+
Tests
^^^^^