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 | 2a9d943122428af480b5b1fa7d7320b3daa97e6f (patch) | |
tree | 717a27a9463174ad01d637b83f26c83bf050dce1 /lib | |
parent | 9c3180383d8b9123b22c71dbebf62ac8b1f4dc91 (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: |