diff options
| author | Tim Graham <timograham@gmail.com> | 2014-03-31 08:10:59 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-03-31 08:10:59 -0400 |
| commit | 246face20984b70b93751d144760bfd9b45d2c09 (patch) | |
| tree | d0fdcac584e90d1c81c035842d0b3688d447f77f | |
| parent | 981b864fbd28590c4ac829ce55bb7543f57d1de8 (diff) | |
Fixed #22362 -- Improved AuthenticationMiddleware assertion message.
Thanks Keryn Knight.
| -rw-r--r-- | django/contrib/auth/middleware.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/contrib/auth/middleware.py b/django/contrib/auth/middleware.py index 3ee742446d..31d42e13cf 100644 --- a/django/contrib/auth/middleware.py +++ b/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)) |
