From 43cb78fafde45fae9e057d29878c2ebf40aef873 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 3 Jul 2011 17:56:25 +0000 Subject: 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 --- django/middleware/doc.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'django') 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() -- cgit v1.3