From 6af514f68a252b9e2770a58cc0313d2d9593f4f5 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Thu, 16 Jul 2020 15:01:18 +0200 Subject: web_support.py: adapt urllib.quote for python3 --- lib/python/web_support.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') 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,9 +23,13 @@ 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 @@ -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: -- cgit v1.2.3