Author: carljm
Date: 2011-10-11 15:21:14 -0700 (Tue, 11 Oct 2011)
New Revision: 16961

Modified:
   django/trunk/docs/ref/request-response.txt
   django/trunk/docs/ref/template-response.txt
   django/trunk/docs/topics/http/middleware.txt
Log:
Fixed #17035, #17036 -- Clarified documentation regarding TemplateResponse and 
middleware handling. Refs #16004. Thanks ptone.

Modified: django/trunk/docs/ref/request-response.txt
===================================================================
--- django/trunk/docs/ref/request-response.txt  2011-10-11 21:55:45 UTC (rev 
16960)
+++ django/trunk/docs/ref/request-response.txt  2011-10-11 22:21:14 UTC (rev 
16961)
@@ -758,3 +758,10 @@
 .. class:: HttpResponseServerError
 
     Acts just like :class:`HttpResponse` but uses a 500 status code.
+
+.. note::
+
+    If a custom subclass of :class:`HttpResponse` implements a ``render``
+    method, Django will treat it as emulating a
+    :class:`~django.template.response.SimpleTemplateResponse`, and the
+    ``render`` method must itself return a valid response object.

Modified: django/trunk/docs/ref/template-response.txt
===================================================================
--- django/trunk/docs/ref/template-response.txt 2011-10-11 21:55:45 UTC (rev 
16960)
+++ django/trunk/docs/ref/template-response.txt 2011-10-11 22:21:14 UTC (rev 
16961)
@@ -126,7 +126,8 @@
 .. method:: SimpleTemplateResponse.render():
 
     Sets :attr:`response.content` to the result obtained by
-    :attr:`SimpleTemplateResponse.rendered_content`.
+    :attr:`SimpleTemplateResponse.rendered_content`, runs all post-rendering
+    callbacks, and returns the resulting response object.
 
     :meth:`~SimpleTemplateResponse.render()` will only have an effect
     the first time it is called. On subsequent calls, it will return

Modified: django/trunk/docs/topics/http/middleware.txt
===================================================================
--- django/trunk/docs/topics/http/middleware.txt        2011-10-11 21:55:45 UTC 
(rev 16960)
+++ django/trunk/docs/topics/http/middleware.txt        2011-10-11 22:21:14 UTC 
(rev 16961)
@@ -121,22 +121,20 @@
 
 .. method:: process_template_response(self, request, response)
 
-``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is the
-:class:`~django.template.response.SimpleTemplateResponse` subclass (e.g.
-:class:`~django.template.response.TemplateResponse`) object returned by a
-Django view.
+``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is a
+subclass of :class:`~django.template.response.SimpleTemplateResponse` (e.g.
+:class:`~django.template.response.TemplateResponse`) or any response object
+that implements a ``render`` method.
 
-``process_template_response()`` must return an
-:class:`~django.template.response.SimpleTemplateResponse` (or its subclass)
-object. It could alter the given ``response`` by changing
-``response.template_name`` and ``response.context_data``, or it could
-create and return a brand-new
-:class:`~django.template.response.SimpleTemplateResponse` (or its subclass)
-instance.
+``process_template_response()`` must return a response object that implements a
+``render`` method. It could alter the given ``response`` by changing
+``response.template_name`` and ``response.context_data``, or it could create
+and return a brand-new
+:class:`~django.template.response.SimpleTemplateResponse` or equivalent.
 
 ``process_template_response()`` will only be called if the response
 instance has a ``render()`` method, indicating that it is a
-:class:`~django.template.response.TemplateResponse`.
+:class:`~django.template.response.TemplateResponse` or equivalent.
 
 You don't need to explicitly render responses -- responses will be
 automatically rendered once all template response middleware has been

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to