Skip to content

Commit c052a86

Browse files
stephenfintomchristie
authored andcommitted
compat: (py2) urlparse = urllib.parse (py3) (#6262)
* compat: (py2) urlparse = urllib.parse (py3) We were mistakenly importing the 'urlparse' function from the Python 2 'urlparse' module, as opposed to the module itself. Correct this. Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #6261 * compat: Remove 'compat.urlparse' We can just use Django's vendored six library, like we do everywhere else. Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent a49d744 commit c052a86

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

rest_framework/compat.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
# Python 2.7
1818
from collections import Mapping # noqa
1919

20-
try:
21-
# Python 3
22-
import urllib.parse as urlparse # noqa
23-
except ImportError:
24-
# Python 2.7
25-
from urlparse import urlparse # noqa
26-
2720
try:
2821
from django.urls import ( # noqa
2922
URLPattern,

rest_framework/renderers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
from django.urls import NoReverseMatch
2222
from django.utils import six
2323
from django.utils.html import mark_safe
24+
from django.utils.six.moves.urllib import parse as urlparse
2425

2526
from rest_framework import VERSION, exceptions, serializers, status
2627
from rest_framework.compat import (
2728
INDENT_SEPARATORS, LONG_SEPARATORS, SHORT_SEPARATORS, coreapi, coreschema,
28-
pygments_css, urlparse, yaml
29+
pygments_css, yaml
2930
)
3031
from rest_framework.exceptions import ParseError
3132
from rest_framework.request import is_form_media_type, override_method

0 commit comments

Comments
 (0)