summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-06-18 14:16:13 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-06-18 14:16:13 +0000
commitc77f83ceaefb39ffac6ff8a24d7189e764458e92 (patch)
tree08d618dc6c7b2aaf24f441f9f40c9fdb94d169b4
parent82ffb6747f63f5e267134c56c6b5d707c5e63049 (diff)
[1.0.X] Fixed #11322 -- Clarified docs regarding middleware processing. Thanks the Michael Malone for the patch.
Merge of r11048 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@11060 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--docs/topics/http/middleware.txt15
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/topics/http/middleware.txt b/docs/topics/http/middleware.txt
index 2bbe405156..4521a34222 100644
--- a/docs/topics/http/middleware.txt
+++ b/docs/topics/http/middleware.txt
@@ -108,15 +108,18 @@ middleware is always called on every response.
``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is the
:class:`~django.http. HttpResponse` object returned by a Django view.
-``process_response()`` should return an :class:`~django.http. HttpResponse`
+``process_response()`` must return an :class:`~django.http. HttpResponse`
object. It could alter the given ``response``, or it could create and return a
brand-new :class:`~django.http. HttpResponse`.
-Remember that your middleware will not be called if another middleware object
-returns a response before you. But unlike ``process_request()`` and
-``process_view()``, during the response phase the classes are applied in reverse
-order, from the bottom up. This means classes defined at the end of
-:setting:`MIDDLEWARE_CLASSES` will be run first.
+Unlike the ``process_request()`` and ``process_view()`` methods, the
+``process_response()`` method is always called, even if the ``process_request()``
+and ``process_view()`` methods of the same middleware class were skipped because
+an earlier middleware method returned an :class:`~django.http. HttpResponse`
+(this means that your ``process_response()`` method cannot rely on setup done in
+``process_request()``, for example). In addition, during the response phase the
+classes are applied in reverse order, from the bottom up. This means classes
+defined at the end of :setting:`MIDDLEWARE_CLASSES` will be run first.
.. _exception-middleware: