Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #22362 -- Improved AuthenticationMiddleware assertion message.

Thanks Keryn Knight.
  • Loading branch information...
commit 246face20984b70b93751d144760bfd9b45d2c09 1 parent 981b864
@timgraham timgraham authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 django/contrib/auth/middleware.py
View
8 django/contrib/auth/middleware.py
@@ -13,8 +13,12 @@ def get_user(request):
class AuthenticationMiddleware(object):
def process_request(self, request):
- assert hasattr(request, 'session'), "The Django authentication middleware requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.sessions.middleware.SessionMiddleware'."
-
+ assert hasattr(request, 'session'), (
+ "The Django authentication middleware requires session middleware "
+ "to be installed. Edit your MIDDLEWARE_CLASSES setting to insert "
+ "'django.contrib.sessions.middleware.SessionMiddleware' before "
+ "'django.contrib.auth.middleware.AuthenticationMiddleware'."
+ )
request.user = SimpleLazyObject(lambda: get_user(request))
Please sign in to comment.
Something went wrong with that request. Please try again.