summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2020-07-16 15:01:18 +0200
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-07-29 10:20:41 +0200
commit6af514f68a252b9e2770a58cc0313d2d9593f4f5 (patch)
tree6e9f5934ca53c522ba4a3e7e4c229a4af1de9635 /lib
parent95f779f1f878ddf7b4bcb7125802761f82530725 (diff)
web_support.py: adapt urllib.quote for python3
Diffstat (limited to 'lib')
-rw-r--r--lib/python/web_support.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/python/web_support.py b/lib/python/web_support.py
index 807edf2fdf..50d62757e8 100644
--- a/lib/python/web_support.py
+++ b/lib/python/web_support.py
@@ -23,10 +23,14 @@ import struct
import sys
import grp
import traceback
-import urllib
import threading
try:
+ from urllib import quote as urllib_quote
+except ImportError:
+ from urllib.parse import quote as urllib_quote
+
+try:
from SocketServer import ThreadingMixIn
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
except ImportError:
@@ -177,8 +181,8 @@ class URLFactory:
if not isinstance(value, (list, tuple)):
value = (value,)
for v in value:
- arglist.append("%s=%s" % (urllib.quote(key),
- urllib.quote(v)))
+ arglist.append("%s=%s" % (urllib_quote(key),
+ urllib_quote(v)))
if arglist:
return "?" + '&'.join(arglist)
else:

© 2014-2024 Faster IT GmbH | imprint | privacy policy