1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

[py3] Ported django.utils.safestring.

Backwards compatibility aliases were created under Python 2.
This commit is contained in:
Aymeric Augustin
2012-08-18 16:04:06 +02:00
parent e41c308014
commit 547b181046
8 changed files with 82 additions and 54 deletions

View File

@@ -119,8 +119,8 @@ def force_text(s, encoding='utf-8', strings_only=False, errors='strict'):
errors) for arg in s])
else:
# Note: We use .decode() here, instead of six.text_type(s, encoding,
# errors), so that if s is a SafeString, it ends up being a
# SafeUnicode at the end.
# errors), so that if s is a SafeBytes, it ends up being a
# SafeText at the end.
s = s.decode(encoding, errors)
except UnicodeDecodeError as e:
if not isinstance(s, Exception):