Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.7.x] Fixed #22362 -- Improved AuthenticationMiddleware assertion m…

…essage.

Thanks Keryn Knight.

Backport of 246face from master
  • Loading branch information...
commit ef3734693277242e98996f591d9acf39e8819441 1 parent 07c42ce
@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.