diff options
| author | mlavin <markdlavin@gmail.com> | 2014-04-20 08:58:29 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-06-13 12:40:42 -0400 |
| commit | d94de802d34c858805a01d3c699799aebc247ec3 (patch) | |
| tree | e6a99c7b37a052a9ebb6820f59f251357a573c72 /django/core | |
| parent | d3bf537324c1164dee45070f90d48661b27a781f (diff) | |
[1.7.x] Fixed #22477 -- Removed contrib middleware from the global settings defaults.
Also added a compatibility check for changed middleware defaults.
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/checks/__init__.py | 1 | ||||
| -rw-r--r-- | django/core/checks/compatibility/django_1_7_0.py | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/django/core/checks/__init__.py b/django/core/checks/__init__.py index 0d2780abd3..d215b82513 100644 --- a/django/core/checks/__init__.py +++ b/django/core/checks/__init__.py @@ -8,6 +8,7 @@ from .registry import register, run_checks, tag_exists, Tags # Import these to force registration of checks import django.core.checks.compatibility.django_1_6_0 # NOQA +import django.core.checks.compatibility.django_1_7_0 # NOQA import django.core.checks.model_checks # NOQA __all__ = [ diff --git a/django/core/checks/compatibility/django_1_7_0.py b/django/core/checks/compatibility/django_1_7_0.py new file mode 100644 index 0000000000..7340be6915 --- /dev/null +++ b/django/core/checks/compatibility/django_1_7_0.py @@ -0,0 +1,36 @@ +from __future__ import unicode_literals + +from .. import Warning, register, Tags + + +@register(Tags.compatibility) +def check_1_7_compatibility(**kwargs): + errors = [] + errors.extend(_check_middleware_classes(**kwargs)) + return errors + + +def _check_middleware_classes(app_configs=None, **kwargs): + """ + Checks if the user has *not* overridden the ``MIDDLEWARE_CLASSES`` setting & + warns them about the global default changes. + """ + from django.conf import settings + + # MIDDLEWARE_CLASSES is overridden by default by startproject. If users + # have removed this override then we'll warn them about the default changes. + if not settings.is_overridden('MIDDLEWARE_CLASSES'): + return [ + Warning( + "MIDDLEWARE_CLASSES is not set.", + hint=("Django 1.7 changed the global defaults for the MIDDLEWARE_CLASSES." + "django.contrib.sessions.middleware.SessionMiddleware, " + "django.contrib.auth.middleware.AuthenticationMiddleware, and " + "django.contrib.messages.middleware.MessageMiddleware were removed from the defaults." + "If your project needs these middleware then you should configure this setting."), + obj=None, + id='1_7.W001', + ) + ] + else: + return [] |
