]> git.ipfire.org Git - pbs.git/commitdiff
web: make_url: Filter out any values that are None
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 21 Jul 2023 15:17:11 +0000 (15:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 21 Jul 2023 15:17:11 +0000 (15:17 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/__init__.py

index 669710bbbec1cce429820cc9ff6a7f5ae429878d..886bc69cc15884ca8c00d738a1c2743a06d19162 100644 (file)
@@ -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)