diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-21 10:00:10 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-08-07 12:00:22 +0200 |
| commit | c5ef65bcf324f4c90b53be90f4aec069a68e8c59 (patch) | |
| tree | bb9a4988fbae4e7366cc578ca845c49003cdcd64 /django/utils/cache.py | |
| parent | ee191715eae73362768184aa95206cf61bac5d38 (diff) | |
[py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
and smart_bytes under Python 2 (which is backwards compatible).
Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
want a str.
Diffstat (limited to 'django/utils/cache.py')
| -rw-r--r-- | django/utils/cache.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py index 8b81a2ffa2..42b0de4ce6 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -23,7 +23,7 @@ import time from django.conf import settings from django.core.cache import get_cache -from django.utils.encoding import iri_to_uri, force_unicode +from django.utils.encoding import iri_to_uri, force_text from django.utils.http import http_date from django.utils.timezone import get_current_timezone_name from django.utils.translation import get_language @@ -169,7 +169,7 @@ def _i18n_cache_key_suffix(request, cache_key): # Windows is known to use non-standard, locale-dependant names. # User-defined tzinfo classes may return absolutely anything. # Hence this paranoid conversion to create a valid cache key. - tz_name = force_unicode(get_current_timezone_name(), errors='ignore') + tz_name = force_text(get_current_timezone_name(), errors='ignore') cache_key += '.%s' % tz_name.encode('ascii', 'ignore').replace(' ', '_') return cache_key |
