Refs #26601 -- Removed obsolete system check for MIDDLEWARE_CLASSES setting.
This commit is contained in:
parent
98760ab0b2
commit
6192bffb13
|
@ -9,7 +9,6 @@ from .registry import Tags, register, run_checks, tag_exists
|
|||
|
||||
# Import these to force registration of checks
|
||||
import django.core.checks.caches # NOQA isort:skip
|
||||
import django.core.checks.compatibility.django_1_10 # NOQA isort:skip
|
||||
import django.core.checks.database # NOQA isort:skip
|
||||
import django.core.checks.model_checks # NOQA isort:skip
|
||||
import django.core.checks.security.base # NOQA isort:skip
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from .. import Tags, Warning, register
|
||||
|
||||
|
||||
@register(Tags.compatibility)
|
||||
def check_duplicate_middleware_settings(app_configs, **kwargs):
|
||||
if settings.MIDDLEWARE is not None and hasattr(settings, 'MIDDLEWARE_CLASSES'):
|
||||
return [Warning(
|
||||
"The MIDDLEWARE_CLASSES setting is deprecated in Django 1.10 "
|
||||
"and the MIDDLEWARE setting takes precedence. Since you've set "
|
||||
"MIDDLEWARE, the value of MIDDLEWARE_CLASSES is ignored.",
|
||||
id='1_10.W001',
|
||||
)]
|
||||
return []
|
|
@ -116,7 +116,8 @@ that might occur as a result of a version upgrade.
|
|||
in Django 2.0*.
|
||||
* **1_10.W001**: The ``MIDDLEWARE_CLASSES`` setting is deprecated in Django
|
||||
1.10 and the :setting:`MIDDLEWARE` setting takes precedence. Since you've
|
||||
set ``MIDDLEWARE``, the value of ``MIDDLEWARE_CLASSES`` is ignored.
|
||||
set ``MIDDLEWARE``, the value of ``MIDDLEWARE_CLASSES`` is ignored. *This
|
||||
check was removed in Django 2.0*.
|
||||
|
||||
Caches
|
||||
------
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
from django.core.checks.compatibility.django_1_10 import \
|
||||
check_duplicate_middleware_settings
|
||||
from django.test import SimpleTestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
|
||||
class CheckDuplicateMiddlwareSettingsTest(SimpleTestCase):
|
||||
|
||||
@override_settings(MIDDLEWARE=[], MIDDLEWARE_CLASSES=['django.middleware.common.CommonMiddleware'])
|
||||
def test_duplicate_setting(self):
|
||||
result = check_duplicate_middleware_settings(None)
|
||||
self.assertEqual(result[0].id, '1_10.W001')
|
||||
|
||||
@override_settings(MIDDLEWARE=None)
|
||||
def test_middleware_not_defined(self):
|
||||
result = check_duplicate_middleware_settings(None)
|
||||
self.assertEqual(len(result), 0)
|
Loading…
Reference in New Issue