From ac37c9e495eb1003cc6d126ed5d686a29fb08596 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 12 Aug 2012 22:22:56 +0200 Subject: [py3] Encoded value before feeding it to hashlib.md5 --- django/core/cache/backends/filebased.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'django/core/cache') 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) -- cgit v1.3