summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-08-13 12:09:20 +0200
committerClaude Paroz <claude@2xlibre.net>2012-08-13 12:56:59 +0200
commit45baaabafb6cf911afad9ec63c86753b284f7269 (patch)
tree4a6a1681bb58d066ce4fd134aa2a660667dbe90b /django/utils
parentd774ad752d9844cb7a28fe338d4d711c8576ee6f (diff)
[py3] Fixed encoding issues in cache key generation
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/cache.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py
index 95b0fba07b..edac6ec75d 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -16,6 +16,7 @@ cache keys to prevent delivery of wrong content.
An example: i18n middleware would need to distinguish caches by the
"Accept-language" header.
"""
+from __future__ import unicode_literals
import hashlib
import re
@@ -170,7 +171,7 @@ def _i18n_cache_key_suffix(request, cache_key):
# User-defined tzinfo classes may return absolutely anything.
# Hence this paranoid conversion to create a valid cache key.
tz_name = force_text(get_current_timezone_name(), errors='ignore')
- cache_key += '.%s' % tz_name.encode('ascii', 'ignore').replace(' ', '_')
+ cache_key += '.%s' % tz_name.encode('ascii', 'ignore').decode('ascii').replace(' ', '_')
return cache_key
def _generate_cache_key(request, method, headerlist, key_prefix):