Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Fixed #11322 -- Clarified docs regarding middleware processin…

…g. 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
  • Loading branch information...
commit c77f83ceaefb39ffac6ff8a24d7189e764458e92 1 parent 82ffb67
Russell Keith-Magee authored June 18, 2009

Showing 1 changed file with 9 additions and 6 deletions. Show diff stats Hide diff stats

  1. 15  docs/topics/http/middleware.txt
15  docs/topics/http/middleware.txt
@@ -108,15 +108,18 @@ middleware is always called on every response.
108 108
 ``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is the
109 109
 :class:`~django.http. HttpResponse` object returned by a Django view.
110 110
 
111  
-``process_response()`` should return an :class:`~django.http. HttpResponse`
  111
+``process_response()`` must return an :class:`~django.http. HttpResponse`
112 112
 object. It could alter the given ``response``, or it could create and return a
113 113
 brand-new :class:`~django.http. HttpResponse`.
114 114
 
115  
-Remember that your middleware will not be called if another middleware object
116  
-returns a response before you. But unlike ``process_request()`` and
117  
-``process_view()``, during the response phase the classes are applied in reverse
118  
-order, from the bottom up. This means classes defined at the end of
119  
-:setting:`MIDDLEWARE_CLASSES` will be run first.
  115
+Unlike the ``process_request()`` and ``process_view()`` methods, the
  116
+``process_response()`` method is always called, even if the ``process_request()``
  117
+and ``process_view()`` methods of the same middleware class were skipped because
  118
+an earlier middleware method returned an :class:`~django.http. HttpResponse`
  119
+(this means that your ``process_response()`` method cannot rely on setup done in
  120
+``process_request()``, for example). In addition, during the response phase the
  121
+classes are applied in reverse order, from the bottom up. This means classes
  122
+defined at the end of :setting:`MIDDLEWARE_CLASSES` will be run first.
120 123
 
121 124
 .. _exception-middleware:
122 125
 

0 notes on commit c77f83c

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