1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[py3] Updated urllib/urllib2/urlparse imports.

Lots of functions were moved. Use explicit imports in all cases
to keey it easy to identify where the functions come from.
This commit is contained in:
Aymeric Augustin
2012-07-20 15:36:52 +02:00
parent bdca5ea345
commit 0d914d08a0
32 changed files with 181 additions and 96 deletions

View File

@@ -1,11 +1,14 @@
import urllib
import sys
import os
import re
import mimetypes
from copy import copy
from io import BytesIO
from urlparse import urlparse, urlsplit
try:
from urllib.parse import unquote, urlparse, urlsplit
except ImportError: # Python 2
from urllib import unquote
from urlparse import urlparse, urlsplit
from django.conf import settings
from django.contrib.auth import authenticate, login
@@ -222,9 +225,9 @@ class RequestFactory(object):
def _get_path(self, parsed):
# If there are parameters, add them
if parsed[3]:
return urllib.unquote(parsed[2] + ";" + parsed[3])
return unquote(parsed[2] + ";" + parsed[3])
else:
return urllib.unquote(parsed[2])
return unquote(parsed[2])
def get(self, path, data={}, **extra):
"Construct a GET request."

View File

@@ -7,7 +7,10 @@ import re
import sys
from copy import copy
from functools import wraps
from urlparse import urlsplit, urlunsplit
try:
from urllib.parse import urlsplit, urlunsplit
except ImportError: # Python 2
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
import select
import socket