summaryrefslogtreecommitdiff
path: root/django/utils/encoding.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-08-28 20:59:56 +0200
committerClaude Paroz <claude@2xlibre.net>2012-08-29 11:20:32 +0200
commitebc773ada3e4f40cf5084268387b873d7fe22e8b (patch)
tree88e136b190e480ed4c8c2310de408a268f4367b2 /django/utils/encoding.py
parent9eafb6592e9ed27a59cb3cd9920c44cf230a6c65 (diff)
Replaced many smart_bytes by force_bytes
In all those occurrences, we didn't care about preserving the lazy status of the strings, but we really wanted to obtain a real bytestring.
Diffstat (limited to 'django/utils/encoding.py')
-rw-r--r--django/utils/encoding.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/utils/encoding.py b/django/utils/encoding.py
index 7027b82a61..998cf4f3f7 100644
--- a/django/utils/encoding.py
+++ b/django/utils/encoding.py
@@ -174,7 +174,7 @@ def force_bytes(s, encoding='utf-8', strings_only=False, errors='strict'):
# An Exception subclass containing non-ASCII data that doesn't
# know how to print itself properly. We shouldn't raise a
# further exception.
- return ' '.join([smart_bytes(arg, encoding, strings_only,
+ return ' '.join([force_bytes(arg, encoding, strings_only,
errors) for arg in s])
return six.text_type(s).encode(encoding, errors)
else:
@@ -225,7 +225,7 @@ def iri_to_uri(iri):
# converted.
if iri is None:
return iri
- return quote(smart_bytes(iri), safe=b"/#%[]=:;$&()+,!?*@'~")
+ return quote(force_bytes(iri), safe=b"/#%[]=:;$&()+,!?*@'~")
def filepath_to_uri(path):
"""Convert an file system path to a URI portion that is suitable for
@@ -244,7 +244,7 @@ def filepath_to_uri(path):
return path
# I know about `os.sep` and `os.altsep` but I want to leave
# some flexibility for hardcoding separators.
- return quote(smart_bytes(path.replace("\\", "/")), safe=b"/~!*()'")
+ return quote(force_bytes(path.replace("\\", "/")), safe=b"/~!*()'")
# The encoding of the default system locale but falls back to the
# given fallback encoding if the encoding is unsupported by python or could