mirror of https://github.com/django/django.git
Simplified force_bytes().
This commit is contained in:
parent
09199734d3
commit
7d6fe18dde
|
@ -99,10 +99,7 @@ def force_bytes(s, encoding='utf-8', strings_only=False, errors='strict'):
|
||||||
return s
|
return s
|
||||||
if isinstance(s, memoryview):
|
if isinstance(s, memoryview):
|
||||||
return bytes(s)
|
return bytes(s)
|
||||||
if isinstance(s, Promise) or not isinstance(s, str):
|
return str(s).encode(encoding, errors)
|
||||||
return str(s).encode(encoding, errors)
|
|
||||||
else:
|
|
||||||
return s.encode(encoding, errors)
|
|
||||||
|
|
||||||
|
|
||||||
smart_str = smart_text
|
smart_str = smart_text
|
||||||
|
|
Loading…
Reference in New Issue