From: Michael Tremer Date: Fri, 21 Jul 2023 15:17:11 +0000 (+0000) Subject: web: make_url: Filter out any values that are None X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae7ff9d67ec4e5cacebe0028c7f45c2972d5b20b;p=pbs.git web: make_url: Filter out any values that are None Signed-off-by: Michael Tremer --- diff --git a/src/web/__init__.py b/src/web/__init__.py index 669710bb..886bc69c 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -309,7 +309,11 @@ class Application(tornado.web.Application): def make_url(self, handler, url, **kwargs): # Format any query arguments and append them to the URL if kwargs: - args = urllib.parse.urlencode(kwargs) + # Filter out None + args = { k : kwargs[k] for k in kwargs if kwargs[k] is not None } + + # Encode into URL format + args = urllib.parse.urlencode(args) url = "%s?%s" % (url, args)