summaryrefslogtreecommitdiff
path: root/django/contrib/staticfiles/storage.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-06 13:40:59 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-10 12:01:00 +0200
commitf1894bae3071da4ee577fc40ae61491f3e03d82c (patch)
tree6a9d6594d0e31adbc886b6e791118786d7987e9c /django/contrib/staticfiles/storage.py
parent81993b47eaac3cea1ebbc610a3a6b824f5195523 (diff)
Refs #28606 -- Removed CachedStaticFilesStorage per deprecation timeline.
Diffstat (limited to 'django/contrib/staticfiles/storage.py')
-rw-r--r--django/contrib/staticfiles/storage.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index 69af9ca297..ba3b62620d 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -3,18 +3,13 @@ import json
import os
import posixpath
import re
-import warnings
from urllib.parse import unquote, urldefrag, urlsplit, urlunsplit
from django.conf import settings
from django.contrib.staticfiles.utils import check_settings, matches_patterns
-from django.core.cache import (
- InvalidCacheBackendError, cache as default_cache, caches,
-)
from django.core.exceptions import ImproperlyConfigured
from django.core.files.base import ContentFile
from django.core.files.storage import FileSystemStorage, get_storage_class
-from django.utils.deprecation import RemovedInDjango31Warning
from django.utils.functional import LazyObject
@@ -430,63 +425,6 @@ class ManifestFilesMixin(HashedFilesMixin):
return urlunsplit(unparsed_name)
-class _MappingCache:
- """
- A small dict-like wrapper for a given cache backend instance.
- """
- def __init__(self, cache):
- self.cache = cache
-
- def __setitem__(self, key, value):
- self.cache.set(key, value)
-
- def __getitem__(self, key):
- value = self.cache.get(key)
- if value is None:
- raise KeyError("Couldn't find a file name '%s'" % key)
- return value
-
- def clear(self):
- self.cache.clear()
-
- def update(self, data):
- self.cache.set_many(data)
-
- def get(self, key, default=None):
- try:
- return self[key]
- except KeyError:
- return default
-
-
-class CachedFilesMixin(HashedFilesMixin):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- try:
- self.hashed_files = _MappingCache(caches['staticfiles'])
- except InvalidCacheBackendError:
- # Use the default backend
- self.hashed_files = _MappingCache(default_cache)
-
- def hash_key(self, name):
- key = hashlib.md5(self.clean_name(name).encode()).hexdigest()
- return 'staticfiles:%s' % key
-
-
-class CachedStaticFilesStorage(CachedFilesMixin, StaticFilesStorage):
- """
- A static file system storage backend which also saves
- hashed copies of the files it saves.
- """
- def __init__(self, *args, **kwargs):
- warnings.warn(
- 'CachedStaticFilesStorage is deprecated in favor of '
- 'ManifestStaticFilesStorage.',
- RemovedInDjango31Warning, stacklevel=2,
- )
- super().__init__(*args, **kwargs)
-
-
class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage):
"""
A static file system storage backend which also saves