Ticket #18220: 18820-1.diff

File 18820-1.diff, 2.3 KB (added by ramiro, 3 years ago)

Patch by Claude

  • django/conf/global_settings.py

    diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
    index a88ea40..4711baa 100644
    a b SESSION_FILE_PATH = None # Directory to store ses 
    464464# CACHE #
    465465#########
    466466
    467 # New format
     467# The cache backends to use.
    468468CACHES = {
     469    'default': {
     470        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
     471    }
    469472}
    470 # The cache backend to use.  See the docstring in django.core.cache for the
    471 # possible values.
    472473CACHE_MIDDLEWARE_KEY_PREFIX = ''
    473474CACHE_MIDDLEWARE_SECONDS = 600
    474475CACHE_MIDDLEWARE_ALIAS = 'default'
  • django/core/cache/__init__.py

    diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py
    index d8095d4..8f07f13 100644
    a b def parse_backend_uri(backend_uri): 
    6464
    6565    return scheme, host, params
    6666
    67 if not settings.CACHES:
    68     legacy_backend = getattr(settings, 'CACHE_BACKEND', None)
    69     if legacy_backend:
    70         import warnings
    71         warnings.warn(
    72             "settings.CACHE_* is deprecated; use settings.CACHES instead.",
    73             DeprecationWarning
    74         )
    75     else:
    76         # The default cache setting is put here so that we
    77         # can differentiate between a user who has provided
    78         # an explicit CACHE_BACKEND of locmem://, and the
    79         # default value. When the deprecation cycle has completed,
    80         # the default can be restored to global_settings.py
    81         settings.CACHE_BACKEND = 'locmem://'
    82 
    83     # Mapping for new-style cache backend api
    84     backend_classes = {
    85         'memcached': 'memcached.CacheClass',
    86         'locmem': 'locmem.LocMemCache',
    87         'file': 'filebased.FileBasedCache',
    88         'db': 'db.DatabaseCache',
    89         'dummy': 'dummy.DummyCache',
    90     }
    91     engine, host, params = parse_backend_uri(settings.CACHE_BACKEND)
    92     if engine in backend_classes:
    93         engine = 'django.core.cache.backends.%s' % backend_classes[engine]
    94     else:
    95         engine = '%s.CacheClass' % engine
    96     defaults = {
    97         'BACKEND': engine,
    98         'LOCATION': host,
    99     }
    100     defaults.update(params)
    101     settings.CACHES[DEFAULT_CACHE_ALIAS] = defaults
    102 
    10367if DEFAULT_CACHE_ALIAS not in settings.CACHES:
    10468    raise ImproperlyConfigured("You must define a '%s' cache" % DEFAULT_CACHE_ALIAS)
Back to Top