Update for new module/namespace for urllib

This commit is contained in:
Magnus Hagander
2019-01-21 12:23:23 +01:00
parent 95df1aa888
commit 499a40baf7
4 changed files with 11 additions and 11 deletions

View File

@ -13,7 +13,7 @@ from django.db import transaction
from django.db.models import Q
import base64
import urllib
import urllib.parse
from Crypto.Cipher import AES
from Crypto import Random
import time
@ -470,7 +470,7 @@ def communityauth(request, siteid):
# care that it's characters are what's in base64.
if 'd' in request.GET:
d = request.GET['d']
if d != urllib.quote_plus(d, '=$'):
if d != urllib.parse.quote_plus(d, '=$'):
# Invalid character, so drop it
d = None
else:
@ -525,7 +525,7 @@ def communityauth(request, siteid):
if site.org.require_consent:
if not CommunityAuthConsent.objects.filter(org=site.org, user=request.user).exists():
return HttpResponseRedirect('/account/auth/{0}/consent/?{1}'.format(siteid,
urllib.urlencode({'next': '/account/auth/{0}/{1}'.format(siteid, urldata)})))
urllib.parse.urlencode({'next': '/account/auth/{0}/{1}'.format(siteid, urldata)})))
info = {
'u': request.user.username.encode('utf-8'),
@ -540,7 +540,7 @@ def communityauth(request, siteid):
# Turn this into an URL. Make sure the timestamp is always first, that makes
# the first block more random..
s = "t=%s&%s" % (int(time.time()), urllib.urlencode(info))
s = "t=%s&%s" % (int(time.time()), urllib.parse.urlencode(info))
# Encrypt it with the shared key (and IV!)
r = Random.new()

View File

@ -15,7 +15,7 @@ import django
from datetime import date, datetime, timedelta
import os
import re
import urllib
import urllib.parse
from pgweb.util.decorators import cache, nocache
from pgweb.util.contexts import render_pgweb, get_nav_menu, PGWebContextProcessor
@ -165,7 +165,7 @@ def _make_sitemap(pagelist):
for p in pagelist:
pages += 1
x.startElement('url', {})
x.add_xml_element('loc', 'https://www.postgresql.org/%s' % urllib.quote(p[0]))
x.add_xml_element('loc', 'https://www.postgresql.org/%s' % urllib.parse.quote(p[0]))
if len(p) > 1 and p[1]:
x.add_xml_element('priority', str(p[1]))
if len(p) > 2 and p[2]:

View File

@ -161,7 +161,7 @@ def search(request):
p['ln'] = MailingList.objects.get(pk=listid).listname
if dateval:
p['d'] = dateval
urlstr = urllib.urlencode(p)
urlstr = urllib.parse.urlencode(p)
# If memcached is available, let's try it
hits = None
if has_memcached:
@ -212,7 +212,7 @@ def search(request):
totalhits = len(hits)
querystr = "?m=1&q=%s&l=%s&d=%s&s=%s" % (
urllib.quote_plus(query.encode('utf-8')),
urllib.parse.quote_plus(query.encode('utf-8')),
listid or '',
dateval,
listsort
@ -281,13 +281,13 @@ def search(request):
totalhits = int(hits[-1][5])
try:
if suburl:
quoted_suburl = urllib.quote_plus(suburl)
quoted_suburl = urllib.parse.quote_plus(suburl)
else:
quoted_suburl = ''
except:
quoted_suburl = ''
querystr = "?q=%s&a=%s&u=%s" % (
urllib.quote_plus(query.encode('utf-8')),
urllib.parse.quote_plus(query.encode('utf-8')),
allsites and "1" or "0",
quoted_suburl,
)

View File

@ -10,7 +10,7 @@ from Crypto import Random
from Crypto.Cipher import AES
import base64
import time
import urllib
import urllib.parse
from optparse import OptionParser