diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-08-28 20:59:56 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-08-29 11:20:32 +0200 |
| commit | ebc773ada3e4f40cf5084268387b873d7fe22e8b (patch) | |
| tree | 88e136b190e480ed4c8c2310de408a268f4367b2 /django/http/__init__.py | |
| parent | 9eafb6592e9ed27a59cb3cd9920c44cf230a6c65 (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/http/__init__.py')
| -rw-r--r-- | django/http/__init__.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/django/http/__init__.py b/django/http/__init__.py index c6f104695d..b458fe6c2e 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -85,7 +85,7 @@ from django.core.files import uploadhandler from django.http.multipartparser import MultiPartParser from django.http.utils import * from django.utils.datastructures import MultiValueDict, ImmutableList -from django.utils.encoding import smart_bytes, smart_str, iri_to_uri, force_text +from django.utils.encoding import force_bytes, force_text, smart_str, iri_to_uri from django.utils.http import cookie_date from django.utils import six from django.utils import timezone @@ -489,13 +489,13 @@ class QueryDict(MultiValueDict): """ output = [] if safe: - safe = smart_bytes(safe, self.encoding) + safe = force_bytes(safe, self.encoding) encode = lambda k, v: '%s=%s' % ((quote(k, safe), quote(v, safe))) else: encode = lambda k, v: urlencode({k: v}) for k, list_ in self.lists(): - k = smart_bytes(k, self.encoding) - output.extend([encode(k, smart_bytes(v, self.encoding)) + k = force_bytes(k, self.encoding) + output.extend([encode(k, force_bytes(v, self.encoding)) for v in list_]) return '&'.join(output) @@ -680,7 +680,7 @@ class HttpResponse(object): # force conversion to bytes in case chunk is a subclass return bytes(value) return b''.join(make_bytes(e) for e in self._container) - return b''.join(smart_bytes(e, self._charset) for e in self._container) + return b''.join(force_bytes(e, self._charset) for e in self._container) @content.setter def content(self, value): |
