summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-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()