Refs #23919 -- Removed unneeded code in force_text().

Unneeded since 7b2f2e74ad.
This commit is contained in:
Vytis Banaitis 2017-02-01 01:31:17 +02:00 committed by Tim Graham
parent ed3215ad53
commit 84126f2789
1 changed files with 3 additions and 6 deletions

View File

@ -62,13 +62,10 @@ def force_text(s, encoding='utf-8', strings_only=False, errors='strict'):
if strings_only and is_protected_type(s): if strings_only and is_protected_type(s):
return s return s
try: try:
if not issubclass(type(s), str):
if isinstance(s, bytes): if isinstance(s, bytes):
s = str(s, encoding, errors) s = str(s, encoding, errors)
else: else:
s = str(s) s = str(s)
else:
str(s, encoding, errors)
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
if not isinstance(s, Exception): if not isinstance(s, Exception):
raise DjangoUnicodeDecodeError(s, *e.args) raise DjangoUnicodeDecodeError(s, *e.args)