summaryrefslogtreecommitdiff
path: root/django/core/cache/__init__.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2011-02-04 14:27:43 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2011-02-04 14:27:43 +0000
commit4306501da7603762fc37dd62cc8a8b87f3f42114 (patch)
tree5b209b560f8d8259da27cf44e561f65024e86862 /django/core/cache/__init__.py
parentd44fb0557a0a9d8fab62b1e48078be498c61287a (diff)
Fixed #15217 -- Made the CACHE_BACKEND deprecation warning more selective, 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
Diffstat (limited to 'django/core/cache/__init__.py')
-rw-r--r--django/core/cache/__init__.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py
index ced9875b07..2c75f6c671 100644
--- a/django/core/cache/__init__.py
+++ b/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',