mirror of
https://github.com/django/django.git
synced 2024-12-25 18:46:22 +00:00
[1.7.x] Fixed #22362 -- Improved AuthenticationMiddleware assertion message.
Thanks Keryn Knight.
Backport of 246face209
from master
This commit is contained in:
parent
07c42cee7f
commit
ef37346932
@ -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))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user