summaryrefslogtreecommitdiff
path: root/django/http
diff options
context:
space:
mode:
Diffstat (limited to 'django/http')
-rw-r--r--django/http/multipartparser.py2
-rw-r--r--django/http/request.py2
-rw-r--r--django/http/response.py10
3 files changed, 7 insertions, 7 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 812e83eff0..b1db1f81ca 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -84,7 +84,7 @@ class MultiPartParser(object):
# This means we shouldn't continue...raise an error.
raise MultiPartParserError("Invalid content length: %r" % content_length)
- if isinstance(boundary, six.text_type):
+ if isinstance(boundary, str):
boundary = boundary.encode('ascii')
self._boundary = boundary
self._input_data = input_data
diff --git a/django/http/request.py b/django/http/request.py
index b4053142ac..fe1684ee58 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -522,7 +522,7 @@ def bytes_to_text(s, encoding):
Returns any non-basestring objects without change.
"""
if isinstance(s, bytes):
- return six.text_type(s, encoding, 'replace')
+ return str(s, encoding, 'replace')
else:
return s
diff --git a/django/http/response.py b/django/http/response.py
index e4cce4fdbe..1c2677035d 100644
--- a/django/http/response.py
+++ b/django/http/response.py
@@ -113,10 +113,10 @@ class HttpResponseBase(six.Iterator):
`value` can't be represented in the given charset, MIME-encoding
is applied.
"""
- if not isinstance(value, (bytes, six.text_type)):
+ if not isinstance(value, (bytes, str)):
value = str(value)
if ((isinstance(value, bytes) and (b'\n' in value or b'\r' in value)) or
- isinstance(value, six.text_type) and ('\n' in value or '\r' in value)):
+ isinstance(value, str) and ('\n' in value or '\r' in value)):
raise BadHeaderError("Header values can't contain newlines (got %r)" % value)
try:
if isinstance(value, str):
@@ -226,11 +226,11 @@ class HttpResponseBase(six.Iterator):
# This doesn't make a copy when `value` already contains bytes.
# Handle string types -- we can't rely on force_bytes here because:
- # - under Python 3 it attempts str conversion first
+ # - Python attempts str conversion first
# - when self._charset != 'utf-8' it re-encodes the content
if isinstance(value, bytes):
return bytes(value)
- if isinstance(value, six.text_type):
+ if isinstance(value, str):
return bytes(value.encode(self.charset))
# Handle non-string types (#16494)
@@ -309,7 +309,7 @@ class HttpResponse(HttpResponseBase):
@content.setter
def content(self, value):
# Consume iterators upon assignment to allow repeated iteration.
- if hasattr(value, '__iter__') and not isinstance(value, (bytes, six.string_types)):
+ if hasattr(value, '__iter__') and not isinstance(value, (bytes, str)):
content = b''.join(self.make_bytes(chunk) for chunk in value)
if hasattr(value, 'close'):
try: