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,3 +1,7 @@
try:
from urllib.parse import urlencode
except ImportError: # Python 2
from urllib import urlencode
from xml.dom.minidom import parseString
from django.contrib.auth.decorators import login_required, permission_required
@@ -9,7 +13,6 @@ from django.shortcuts import render_to_response
from django.template import Context, Template
from django.utils.decorators import method_decorator
def get_view(request):
"A simple view that expects a GET request, and returns a rendered template"
t = Template('This is a test. {{ var }} is the value.', name='GET Template')
@@ -58,7 +61,6 @@ def raw_post_view(request):
def redirect_view(request):
"A view that redirects all requests to the GET view"
if request.GET:
from urllib import urlencode
query = '?' + urlencode(request.GET, True)
else:
query = ''