Refs #25079 -- Removed obsolete system check for TEMPLATE_* settings.
This commit is contained in:
parent
0bf3228eec
commit
98760ab0b2
|
@ -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_8_0 # 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
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from .. import Tags, Warning, register
|
||||
|
||||
|
||||
@register(Tags.compatibility)
|
||||
def check_duplicate_template_settings(app_configs, **kwargs):
|
||||
if settings.TEMPLATES:
|
||||
values = [
|
||||
'TEMPLATE_DIRS',
|
||||
'TEMPLATE_CONTEXT_PROCESSORS',
|
||||
'TEMPLATE_DEBUG',
|
||||
'TEMPLATE_LOADERS',
|
||||
'TEMPLATE_STRING_IF_INVALID',
|
||||
]
|
||||
defined = [value for value in values if getattr(settings, value, None)]
|
||||
if defined:
|
||||
return [Warning(
|
||||
"The standalone TEMPLATE_* settings were deprecated in Django "
|
||||
"1.8 and the TEMPLATES dictionary takes precedence. You must "
|
||||
"put the values of the following settings into your default "
|
||||
"TEMPLATES dict: %s." % ", ".join(defined),
|
||||
id='1_8.W001',
|
||||
)]
|
||||
return []
|
|
@ -112,7 +112,8 @@ that might occur as a result of a version upgrade.
|
|||
Django 1.8 and the :setting:`TEMPLATES` dictionary takes precedence. You must
|
||||
put the values of the following settings into your defaults ``TEMPLATES``
|
||||
dict: ``TEMPLATE_DIRS``, ``TEMPLATE_CONTEXT_PROCESSORS``, ``TEMPLATE_DEBUG``,
|
||||
``TEMPLATE_LOADERS``, ``TEMPLATE_STRING_IF_INVALID``.
|
||||
``TEMPLATE_LOADERS``, ``TEMPLATE_STRING_IF_INVALID``. *This check was removed
|
||||
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.
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
from django.core.checks.compatibility.django_1_8_0 import \
|
||||
check_duplicate_template_settings
|
||||
from django.test import SimpleTestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
|
||||
class CheckDuplicateTemplateSettingsTest(SimpleTestCase):
|
||||
|
||||
def test_not_raised_if_no_templates_setting(self):
|
||||
self.assertEqual(check_duplicate_template_settings(None), [])
|
||||
|
||||
@override_settings(
|
||||
TEMPLATES=[{'BACKEND': 'django.template.backends.django.DjangoTemplates'}],
|
||||
TEMPLATE_DIRS=['/path/to/dirs'],
|
||||
)
|
||||
def test_duplicate_setting(self):
|
||||
result = check_duplicate_template_settings(None)
|
||||
self.assertEqual(result[0].id, '1_8.W001')
|
||||
|
||||
@override_settings(
|
||||
TEMPLATES=[{'BACKEND': 'django.template.backends.django.DjangoTemplates'}],
|
||||
TEMPLATE_DIRS=['/path/to/dirs'],
|
||||
TEMPLATE_DEBUG=True,
|
||||
)
|
||||
def test_multiple_duplicate_settings(self):
|
||||
result = check_duplicate_template_settings(None)
|
||||
self.assertEqual(len(result), 1)
|
||||
self.assertIn('TEMPLATE_DIRS', result[0].msg)
|
||||
self.assertIn('TEMPLATE_DEBUG', result[0].msg)
|
Loading…
Reference in New Issue