diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-07-16 15:01:18 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-07-29 10:20:41 +0200 |
commit | 3dedb21b13704b106b0024746e74c2406ed3761a (patch) | |
tree | a9955dd22f903fc2d2625abee70e7b12346674f5 /lib | |
parent | 01eec07fa5dafac4fcc6f248517003996dfc5bfa (diff) |
web_support.py: adapt urllib.quote for python3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/web_support.py | 10 |
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: |