diff options
| author | Tim Graham <timograham@gmail.com> | 2017-02-03 19:38:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-03 19:38:33 -0500 |
| commit | 2d899ce16bdbef1a015275237f0bfef4045fb6b2 (patch) | |
| tree | fd40a36a033d1b7d63bde726a6547172aa6e82e6 /django/utils/encoding.py | |
| parent | 26619ad7b069b9113d154c11c586935ee9aaa4c4 (diff) | |
Refs #23919 -- Removed a Python 2 code path in force_text().
Reverted the obsolete fix and tests for refs #12302.
Diffstat (limited to 'django/utils/encoding.py')
| -rw-r--r-- | django/utils/encoding.py | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/django/utils/encoding.py b/django/utils/encoding.py index 65bc1ad728..a050586cba 100644 --- a/django/utils/encoding.py +++ b/django/utils/encoding.py @@ -66,16 +66,7 @@ def force_text(s, encoding='utf-8', strings_only=False, errors='strict'): else: s = str(s) except UnicodeDecodeError as e: - if not isinstance(s, Exception): - raise DjangoUnicodeDecodeError(s, *e.args) - else: - # If we get to here, the caller has passed in an Exception - # subclass populated with non-ASCII bytestring data without a - # working __str__() method. Try to handle this without raising a - # further exception by individually forcing the exception args - # to strings. - s = ' '.join(force_text(arg, encoding, strings_only, errors) - for arg in s) + raise DjangoUnicodeDecodeError(s, *e.args) return s |
