mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +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:
committed by
Tim Graham
parent
05c888ffb8
commit
9baf692a58
@@ -30,7 +30,7 @@ class PermanentRedirectLocaleMiddleWare(LocaleMiddleware):
|
||||
('en', 'English'),
|
||||
('pt-br', 'Brazilian Portuguese'),
|
||||
],
|
||||
MIDDLEWARE_CLASSES=[
|
||||
MIDDLEWARE=[
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
],
|
||||
@@ -223,7 +223,7 @@ class URLRedirectTests(URLTestCaseBase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@override_settings(
|
||||
MIDDLEWARE_CLASSES=[
|
||||
MIDDLEWARE=[
|
||||
'i18n.patterns.tests.PermanentRedirectLocaleMiddleWare',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
],
|
||||
|
||||
@@ -1756,7 +1756,7 @@ class MultipleLocaleActivationTests(SimpleTestCase):
|
||||
('en', 'English'),
|
||||
('fr', 'French'),
|
||||
],
|
||||
MIDDLEWARE_CLASSES=[
|
||||
MIDDLEWARE=[
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
],
|
||||
@@ -1772,7 +1772,7 @@ class LocaleMiddlewareTests(TestCase):
|
||||
self.assertContains(response, "Yes/No")
|
||||
|
||||
@override_settings(
|
||||
MIDDLEWARE_CLASSES=[
|
||||
MIDDLEWARE=[
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
@@ -1792,7 +1792,7 @@ class LocaleMiddlewareTests(TestCase):
|
||||
('en', 'English'),
|
||||
('fr', 'French'),
|
||||
],
|
||||
MIDDLEWARE_CLASSES=[
|
||||
MIDDLEWARE=[
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
],
|
||||
@@ -1828,7 +1828,7 @@ class UnprefixedDefaultLanguageTests(SimpleTestCase):
|
||||
('en-us', 'English'),
|
||||
('pt-br', 'Portuguese (Brazil)'),
|
||||
],
|
||||
MIDDLEWARE_CLASSES=[
|
||||
MIDDLEWARE=[
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user