summaryrefslogtreecommitdiff
path: root/django/http
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-01-07 12:11:46 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-18 21:33:28 +0100
commit2b281cc35ed9d997614ca3c416928d7fabfef1ad (patch)
treed3e73cf44b15139aa9f1f53e398942ba64f5e190 /django/http
parent7b2f2e74adb36a4334e83130f6abc2f79d395235 (diff)
Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
Diffstat (limited to 'django/http')
-rw-r--r--django/http/cookie.py11
-rw-r--r--django/http/multipartparser.py10
-rw-r--r--django/http/request.py8
-rw-r--r--django/http/response.py9
4 files changed, 17 insertions, 21 deletions
diff --git a/django/http/cookie.py b/django/http/cookie.py
index 7251d04c40..f45ef11295 100644
--- a/django/http/cookie.py
+++ b/django/http/cookie.py
@@ -1,6 +1,5 @@
import sys
-
-from django.utils.six.moves import http_cookies
+from http import cookies
# Cookie pickling bug is fixed in Python 2.7.9 and Python 3.4.3+
# http://bugs.python.org/issue22775
@@ -10,11 +9,11 @@ cookie_pickles_properly = (
)
if cookie_pickles_properly:
- SimpleCookie = http_cookies.SimpleCookie
+ SimpleCookie = cookies.SimpleCookie
else:
- Morsel = http_cookies.Morsel
+ Morsel = cookies.Morsel
- class SimpleCookie(http_cookies.SimpleCookie):
+ class SimpleCookie(cookies.SimpleCookie):
if not cookie_pickles_properly:
def __setitem__(self, key, value):
# Apply the fix from http://bugs.python.org/issue22775 where
@@ -41,5 +40,5 @@ def parse_cookie(cookie):
key, val = key.strip(), val.strip()
if key or val:
# unquote using Python's algorithm.
- cookiedict[key] = http_cookies._unquote(val)
+ cookiedict[key] = cookies._unquote(val)
return cookiedict
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index b1db1f81ca..4cbb98afdd 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -8,6 +8,7 @@ import base64
import binascii
import cgi
import sys
+from urllib.parse import unquote
from django.conf import settings
from django.core.exceptions import (
@@ -19,7 +20,6 @@ from django.core.files.uploadhandler import (
from django.utils import six
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import force_text
-from django.utils.six.moves.urllib.parse import unquote
from django.utils.text import unescape_entities
__all__ = ('MultiPartParser', 'MultiPartParserError', 'InputStreamExhausted')
@@ -312,7 +312,7 @@ class MultiPartParser(object):
handler.file.close()
-class LazyStream(six.Iterator):
+class LazyStream:
"""
The LazyStream wrapper allows one to get and "unget" bytes from a stream.
@@ -429,7 +429,7 @@ class LazyStream(six.Iterator):
)
-class ChunkIter(six.Iterator):
+class ChunkIter:
"""
An iterable that will yield chunks of data. Given a file-like object as the
constructor, this object will yield chunks of read operations from that
@@ -453,7 +453,7 @@ class ChunkIter(six.Iterator):
return self
-class InterBoundaryIter(six.Iterator):
+class InterBoundaryIter:
"""
A Producer that will iterate over boundaries.
"""
@@ -471,7 +471,7 @@ class InterBoundaryIter(six.Iterator):
raise StopIteration()
-class BoundaryIter(six.Iterator):
+class BoundaryIter:
"""
A Producer that is sensitive to boundaries.
diff --git a/django/http/request.py b/django/http/request.py
index fe1684ee58..a930c93b26 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -3,6 +3,7 @@ import re
import sys
from io import BytesIO
from itertools import chain
+from urllib.parse import quote, urlencode, urljoin, urlsplit
from django.conf import settings
from django.core import signing
@@ -17,9 +18,6 @@ from django.utils.encoding import (
escape_uri_path, force_bytes, force_str, iri_to_uri,
)
from django.utils.http import is_same_domain, limited_parse_qsl
-from django.utils.six.moves.urllib.parse import (
- quote, urlencode, urljoin, urlsplit,
-)
RAISE_ERROR = object()
host_validation_re = re.compile(r"^([a-z0-9.-]+|\[[a-f0-9]*:[a-f0-9\.:]+\])(:\d+)?$")
@@ -431,14 +429,14 @@ class QueryDict(MultiValueDict):
def __copy__(self):
result = self.__class__('', mutable=True, encoding=self.encoding)
- for key, value in six.iterlists(self):
+ for key, value in self.lists():
result.setlist(key, value)
return result
def __deepcopy__(self, memo):
result = self.__class__('', mutable=True, encoding=self.encoding)
memo[id(self)] = result
- for key, value in six.iterlists(self):
+ for key, value in self.lists():
result.setlist(copy.deepcopy(key, memo), copy.deepcopy(value, memo))
return result
diff --git a/django/http/response.py b/django/http/response.py
index 1c2677035d..c5294acbbd 100644
--- a/django/http/response.py
+++ b/django/http/response.py
@@ -4,20 +4,19 @@ import re
import sys
import time
from email.header import Header
+from http.client import responses
+from urllib.parse import urlparse
from django.conf import settings
from django.core import signals, signing
from django.core.exceptions import DisallowedRedirect
from django.core.serializers.json import DjangoJSONEncoder
from django.http.cookie import SimpleCookie
-from django.utils import six, timezone
+from django.utils import timezone
from django.utils.encoding import (
force_bytes, force_str, force_text, iri_to_uri,
)
from django.utils.http import cookie_date
-from django.utils.six.moves import map
-from django.utils.six.moves.http_client import responses
-from django.utils.six.moves.urllib.parse import urlparse
_charset_from_content_type_re = re.compile(r';\s*charset=(?P<charset>[^\s;]+)', re.I)
@@ -26,7 +25,7 @@ class BadHeaderError(ValueError):
pass
-class HttpResponseBase(six.Iterator):
+class HttpResponseBase:
"""
An HTTP response base class with dictionary-accessed headers.