mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #26601 -- Improved middleware per DEP 0005.
Thanks Tim Graham for polishing the patch, updating the tests, and writing documentation. Thanks Carl Meyer for shepherding the DEP.
This commit is contained in:
parent
05c888ffb8
commit
9baf692a58
81 changed files with 900 additions and 1414 deletions
|
@ -23,7 +23,7 @@ class RemoteUserTest(TestCase):
|
|||
def setUp(self):
|
||||
self.patched_settings = modify_settings(
|
||||
AUTHENTICATION_BACKENDS={'append': self.backend},
|
||||
MIDDLEWARE_CLASSES={'append': self.middleware},
|
||||
MIDDLEWARE={'append': self.middleware},
|
||||
)
|
||||
self.patched_settings.enable()
|
||||
|
||||
|
@ -151,6 +151,21 @@ class RemoteUserTest(TestCase):
|
|||
self.assertTrue(response.context['user'].is_anonymous)
|
||||
|
||||
|
||||
@override_settings(MIDDLEWARE=None)
|
||||
class RemoteUserTestMiddlewareClasses(RemoteUserTest):
|
||||
|
||||
def setUp(self):
|
||||
self.patched_settings = modify_settings(
|
||||
AUTHENTICATION_BACKENDS={'append': self.backend},
|
||||
MIDDLEWARE_CLASSES={'append': [
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
self.middleware,
|
||||
]},
|
||||
)
|
||||
self.patched_settings.enable()
|
||||
|
||||
|
||||
class RemoteUserNoCreateBackend(RemoteUserBackend):
|
||||
"""Backend that doesn't create unknown users."""
|
||||
create_unknown_user = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue