~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to docs/ref/middleware.txt

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-10-12 11:34:35 UTC
  • mfrom: (1.2.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: james.westby@ubuntu.com-20101012113435-9lnsrh0i3mxozbt0
Tags: upstream-1.2.3
ImportĀ upstreamĀ versionĀ 1.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.. _ref-middleware:
2
 
 
3
1
==========
4
2
Middleware
5
3
==========
9
7
 
10
8
This document explains all middleware components that come with Django. For
11
9
information on how how to use them and how to write your own middleware, see
12
 
the :ref:`middleware usage guide <topics-http-middleware>`.
 
10
the :doc:`middleware usage guide </topics/http/middleware>`.
13
11
 
14
12
Available middleware
15
13
====================
26
24
 
27
25
Enable the site-wide cache. If these are enabled, each Django-powered page will
28
26
be cached for as long as the :setting:`CACHE_MIDDLEWARE_SECONDS` setting
29
 
defines. See the :ref:`cache documentation <topics-cache>`.
 
27
defines. See the :doc:`cache documentation </topics/cache>`.
30
28
 
31
29
"Common" middleware
32
30
-------------------
136
134
.. class:: django.middleware.locale.LocaleMiddleware
137
135
 
138
136
Enables language selection based on data from the request. It customizes
139
 
content for each user. See the :ref:`internationalization documentation
140
 
<topics-i18n>`.
 
137
content for each user. See the :doc:`internationalization documentation
 
138
</topics/i18n/index>`.
141
139
 
142
140
Message middleware
143
141
------------------
151
149
   ``MessageMiddleware`` was added.
152
150
 
153
151
Enables cookie- and session-based message support. See the
154
 
:ref:`messages documentation <ref-contrib-messages>`.
 
152
:doc:`messages documentation </ref/contrib/messages>`.
155
153
 
156
154
Session middleware
157
155
------------------
161
159
 
162
160
.. class:: django.contrib.sessions.middleware.SessionMiddleware
163
161
 
164
 
Enables session support. See the :ref:`session documentation
165
 
<topics-http-sessions>`.
 
162
Enables session support. See the :doc:`session documentation
 
163
</topics/http/sessions>`.
166
164
 
167
165
Authentication middleware
168
166
-------------------------
173
171
.. class:: django.contrib.auth.middleware.AuthenticationMiddleware
174
172
 
175
173
Adds the ``user`` attribute, representing the currently-logged-in user, to
176
 
every incoming ``HttpRequest`` object. See :ref:`Authentication in Web requests
177
 
<topics-auth>`.
 
174
every incoming ``HttpRequest`` object. See :doc:`Authentication in Web requests
 
175
</topics/auth>`.
178
176
 
179
177
CSRF protection middleware
180
178
--------------------------
189
187
 
190
188
Adds protection against Cross Site Request Forgeries by adding hidden form
191
189
fields to POST forms and checking requests for the correct value. See the
192
 
:ref:`Cross Site Request Forgery protection documentation <ref-contrib-csrf>`.
 
190
:doc:`Cross Site Request Forgery protection documentation </ref/contrib/csrf>`.
193
191
 
194
192
Transaction middleware
195
193
----------------------
208
206
Middleware modules running inside it (coming later in the stack) will be under
209
207
the same transaction control as the view functions.
210
208
 
211
 
See the :ref:`transaction management documentation <topics-db-transactions>`.
 
209
See the :doc:`transaction management documentation </topics/db/transactions>`.