diff options
Diffstat (limited to 'django/core/cache')
| -rw-r--r-- | django/core/cache/backends/db.py | 4 | ||||
| -rw-r--r-- | django/core/cache/backends/filebased.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py index 52db4d1b1d..348b03f733 100644 --- a/django/core/cache/backends/db.py +++ b/django/core/cache/backends/db.py @@ -12,7 +12,7 @@ from django.conf import settings from django.core.cache.backends.base import BaseCache from django.db import connections, router, transaction, DatabaseError from django.utils import timezone -from django.utils.encoding import smart_bytes +from django.utils.encoding import force_bytes class Options(object): @@ -73,7 +73,7 @@ class DatabaseCache(BaseDatabaseCache): transaction.commit_unless_managed(using=db) return default value = connections[db].ops.process_clob(row[1]) - return pickle.loads(base64.b64decode(smart_bytes(value))) + return pickle.loads(base64.b64decode(force_bytes(value))) def set(self, key, value, timeout=None, version=None): key = self.make_key(key, version=version) diff --git a/django/core/cache/backends/filebased.py b/django/core/cache/backends/filebased.py index c54e8d280f..96194d458f 100644 --- a/django/core/cache/backends/filebased.py +++ b/django/core/cache/backends/filebased.py @@ -10,7 +10,7 @@ except ImportError: import pickle from django.core.cache.backends.base import BaseCache -from django.utils.encoding import smart_bytes +from django.utils.encoding import force_bytes class FileBasedCache(BaseCache): def __init__(self, dir, params): @@ -137,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(smart_bytes(key)).hexdigest() + path = hashlib.md5(force_bytes(key)).hexdigest() path = os.path.join(path[:2], path[2:4], path[4:]) return os.path.join(self._dir, path) |
