Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22362 closed Cleanup/optimization (fixed)

Authentication Middleware assertion message is only partially correct

Reported by: Keryn Knight <django@…> Owned by: nobody
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Currently, the middleware says The Django authentication middleware requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.sessions.middleware.SessionMiddleware'. which is true, but doesn't expound the need for the session middleware to be before the auth middleware, because it acts on the request.

eg:

MIDDLEWARE_CLASSES = (
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
)

would fail the assertion, where

MIDDLEWARE_CLASSES = (
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
)

would pass.

Change History (2)

comment:1 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 246face20984b70b93751d144760bfd9b45d2c09:

Fixed #22362 -- Improved AuthenticationMiddleware assertion message.

Thanks Keryn Knight.

comment:2 by Tim Graham <timograham@…>, 10 years ago

In ef3734693277242e98996f591d9acf39e8819441:

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

Thanks Keryn Knight.

Backport of 246face209 from master

Note: See TracTickets for help on using tickets.
Back to Top