Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #15217 -- Made the CACHE_BACKEND deprecation warning more selec…

…tive, so it doesn't catch the default case. Thanks to adamv for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15406 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4306501da7603762fc37dd62cc8a8b87f3f42114 1 parent d44fb05
@freakboy3742 freakboy3742 authored
Showing with 15 additions and 6 deletions.
  1. +0 −1  django/conf/global_settings.py
  2. +15 −5 django/core/cache/__init__.py
View
1  django/conf/global_settings.py
@@ -436,7 +436,6 @@
}
# The cache backend to use. See the docstring in django.core.cache for the
# possible values.
-CACHE_BACKEND = 'locmem://'
CACHE_MIDDLEWARE_KEY_PREFIX = ''
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = 'default'
View
20 django/core/cache/__init__.py
@@ -75,11 +75,21 @@ def parse_backend_uri(backend_uri):
return scheme, host, params
if not settings.CACHES:
- import warnings
- warnings.warn(
- "settings.CACHE_* is deprecated; use settings.CACHES instead.",
- PendingDeprecationWarning
- )
+ legacy_backend = getattr(settings, 'CACHE_BACKEND', None)
+ if legacy_backend:
+ import warnings
+ warnings.warn(
+ "settings.CACHE_* is deprecated; use settings.CACHES instead.",
+ PendingDeprecationWarning
+ )
+ else:
+ # The default cache setting is put here so that we
+ # can differentiate between a user who has provided
+ # an explicit CACHE_BACKEND of locmem://, and the
+ # default value. When the deprecation cycle has completed,
+ # the default can be restored to global_settings.py
+ settings.CACHE_BACKEND = 'locmem://'
+
# Mapping for new-style cache backend api
backend_classes = {
'memcached': 'memcached.CacheClass',
Please sign in to comment.
Something went wrong with that request. Please try again.