mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
[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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user