Code

Ticket #18220: 18220-2.diff

File 18220-2.diff, 3.3 KB (added by claudep, 2 years ago)

Removed from settings doc and add entry in deprecation timeline

Line 
1diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
2index a88ea40..4711baa 100644
3--- a/django/conf/global_settings.py
4+++ b/django/conf/global_settings.py
5@@ -464,11 +464,12 @@ SESSION_FILE_PATH = None                                # Directory to store ses
6 # CACHE #
7 #########
8 
9-# New format
10+# The cache backends to use.
11 CACHES = {
12+    'default': {
13+        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
14+    }
15 }
16-# The cache backend to use.  See the docstring in django.core.cache for the
17-# possible values.
18 CACHE_MIDDLEWARE_KEY_PREFIX = ''
19 CACHE_MIDDLEWARE_SECONDS = 600
20 CACHE_MIDDLEWARE_ALIAS = 'default'
21diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py
22index d8095d4..8f07f13 100644
23--- a/django/core/cache/__init__.py
24+++ b/django/core/cache/__init__.py
25@@ -64,42 +64,6 @@ def parse_backend_uri(backend_uri):
26 
27     return scheme, host, params
28 
29-if not settings.CACHES:
30-    legacy_backend = getattr(settings, 'CACHE_BACKEND', None)
31-    if legacy_backend:
32-        import warnings
33-        warnings.warn(
34-            "settings.CACHE_* is deprecated; use settings.CACHES instead.",
35-            DeprecationWarning
36-        )
37-    else:
38-        # The default cache setting is put here so that we
39-        # can differentiate between a user who has provided
40-        # an explicit CACHE_BACKEND of locmem://, and the
41-        # default value. When the deprecation cycle has completed,
42-        # the default can be restored to global_settings.py
43-        settings.CACHE_BACKEND = 'locmem://'
44-
45-    # Mapping for new-style cache backend api
46-    backend_classes = {
47-        'memcached': 'memcached.CacheClass',
48-        'locmem': 'locmem.LocMemCache',
49-        'file': 'filebased.FileBasedCache',
50-        'db': 'db.DatabaseCache',
51-        'dummy': 'dummy.DummyCache',
52-    }
53-    engine, host, params = parse_backend_uri(settings.CACHE_BACKEND)
54-    if engine in backend_classes:
55-        engine = 'django.core.cache.backends.%s' % backend_classes[engine]
56-    else:
57-        engine = '%s.CacheClass' % engine
58-    defaults = {
59-        'BACKEND': engine,
60-        'LOCATION': host,
61-    }
62-    defaults.update(params)
63-    settings.CACHES[DEFAULT_CACHE_ALIAS] = defaults
64-
65 if DEFAULT_CACHE_ALIAS not in settings.CACHES:
66     raise ImproperlyConfigured("You must define a '%s' cache" % DEFAULT_CACHE_ALIAS)
67 
68diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
69index e3a5e1a..3096e6a 100644
70--- a/docs/internals/deprecation.txt
71+++ b/docs/internals/deprecation.txt
72@@ -186,6 +186,8 @@ these changes.
73   library earlier than 2.1. An accelerated timeline was used as this was
74   a security related deprecation.
75 
76+* The ``CACHE_BACKEND`` setting will be removed. The cache backend(s) should be
77+  specified in the :setting:`CACHES` setting.
78 
79 1.6
80 ---
81diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
82index 7b5c363..ede2d37 100644
83--- a/docs/ref/settings.txt
84+++ b/docs/ref/settings.txt
85@@ -2311,15 +2311,6 @@ ADMIN_MEDIA_PREFIX
86    integration. See the :doc:`Django 1.4 release notes</releases/1.4>` for
87    more information.
88 
89-.. setting:: CACHE_BACKEND
90-
91-CACHE_BACKEND
92--------------
93-
94-.. deprecated:: 1.3
95-   This setting has been replaced by :setting:`BACKEND <CACHES-BACKEND>` in
96-   :setting:`CACHES`.
97-
98 .. setting:: IGNORABLE_404_ENDS
99 
100 IGNORABLE_404_ENDS