Refs #27795 -- Removed force_bytes() usage in contrib/staticfiles/storage.py.
This commit is contained in:
parent
b0b4aac555
commit
4ab071f43c
|
@ -14,7 +14,6 @@ from django.core.cache import (
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
from django.core.files.storage import FileSystemStorage, get_storage_class
|
from django.core.files.storage import FileSystemStorage, get_storage_class
|
||||||
from django.utils.encoding import force_bytes
|
|
||||||
from django.utils.functional import LazyObject
|
from django.utils.functional import LazyObject
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,7 +295,7 @@ class HashedFilesMixin:
|
||||||
if hashed_file_exists:
|
if hashed_file_exists:
|
||||||
self.delete(hashed_name)
|
self.delete(hashed_name)
|
||||||
# then save the processed result
|
# then save the processed result
|
||||||
content_file = ContentFile(force_bytes(content))
|
content_file = ContentFile(content.encode())
|
||||||
# Save intermediate file for reference
|
# Save intermediate file for reference
|
||||||
saved_name = self._save(hashed_name, content_file)
|
saved_name = self._save(hashed_name, content_file)
|
||||||
hashed_name = self.hashed_name(name, content_file)
|
hashed_name = self.hashed_name(name, content_file)
|
||||||
|
@ -466,7 +465,7 @@ class CachedFilesMixin(HashedFilesMixin):
|
||||||
self.hashed_files = _MappingCache(default_cache)
|
self.hashed_files = _MappingCache(default_cache)
|
||||||
|
|
||||||
def hash_key(self, name):
|
def hash_key(self, name):
|
||||||
key = hashlib.md5(force_bytes(self.clean_name(name))).hexdigest()
|
key = hashlib.md5(self.clean_name(name).encode()).hexdigest()
|
||||||
return 'staticfiles:%s' % key
|
return 'staticfiles:%s' % key
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue