summaryrefslogtreecommitdiff
path: root/django/middleware
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-07-03 17:56:25 +0000
committerJannis Leidel <jannis@leidel.info>2011-07-03 17:56:25 +0000
commit43cb78fafde45fae9e057d29878c2ebf40aef873 (patch)
treeab7b764d09121298602e771ef739a44718595b1d /django/middleware
parentc29e45491ea2e2a689299abda1b722ff814efd80 (diff)
Fixed #14506 -- Added an assertion to XViewMiddleware about the dependency on the authentication middleware. Thanks, vanschelven.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/middleware')
-rw-r--r--django/middleware/doc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/middleware/doc.py b/django/middleware/doc.py
index 4f91503c43..ee3fe2cb2f 100644
--- a/django/middleware/doc.py
+++ b/django/middleware/doc.py
@@ -12,6 +12,10 @@ class XViewMiddleware(object):
indicating the view function. This is used by the documentation module
to lookup the view function for an arbitrary page.
"""
+ assert hasattr(request, 'user'), (
+ "The XView middleware requires authentication middleware to be "
+ "installed. Edit your MIDDLEWARE_CLASSES setting to insert "
+ "'django.contrib.auth.middleware.AuthenticationMiddleware'.")
if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or
(request.user.is_active and request.user.is_staff)):
response = http.HttpResponse()