summaryrefslogtreecommitdiff
path: root/django/core/cache
diff options
context:
space:
mode:
Diffstat (limited to 'django/core/cache')
-rw-r--r--django/core/cache/backends/filebased.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/cache/backends/filebased.py b/django/core/cache/backends/filebased.py
index 1170996a76..c54e8d280f 100644
--- a/django/core/cache/backends/filebased.py
+++ b/django/core/cache/backends/filebased.py
@@ -10,6 +10,7 @@ except ImportError:
import pickle
from django.core.cache.backends.base import BaseCache
+from django.utils.encoding import smart_bytes
class FileBasedCache(BaseCache):
def __init__(self, dir, params):
@@ -136,7 +137,7 @@ class FileBasedCache(BaseCache):
Thus, a cache key of "foo" gets turnned into a file named
``{cache-dir}ac/bd/18db4cc2f85cedef654fccc4a4d8``.
"""
- path = hashlib.md5(key).hexdigest()
+ path = hashlib.md5(smart_bytes(key)).hexdigest()
path = os.path.join(path[:2], path[2:4], path[4:])
return os.path.join(self._dir, path)