Ticket #14506: patch

File patch, 806 bytes (added by vanschelven, 5 years ago)

Assert the right middleware is running similar to contrib.auth.middleware

  • django/middleware/doc.py

    diff -r cf2ca8865912 django/middleware/doc.py
    a b  
    1212        indicating the view function.  This is used by the documentation module
    1313        to lookup the view function for an arbitrary page.
    1414        """
     15        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'."
    1516        if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or
    1617                                         (request.user.is_active and request.user.is_staff)):
    1718            response = http.HttpResponse()
Back to Top