summaryrefslogtreecommitdiff
path: root/django/core/cache
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-08-28 20:59:56 +0200
committerClaude Paroz <claude@2xlibre.net>2012-08-29 11:20:32 +0200
commitebc773ada3e4f40cf5084268387b873d7fe22e8b (patch)
tree88e136b190e480ed4c8c2310de408a268f4367b2 /django/core/cache
parent9eafb6592e9ed27a59cb3cd9920c44cf230a6c65 (diff)
Replaced many smart_bytes by force_bytes
In all those occurrences, we didn't care about preserving the lazy status of the strings, but we really wanted to obtain a real bytestring.
Diffstat (limited to 'django/core/cache')
-rw-r--r--django/core/cache/backends/db.py4
-rw-r--r--django/core/cache/backends/filebased.py4
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)