From ae7ff9d67ec4e5cacebe0028c7f45c2972d5b20b Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 21 Jul 2023 15:17:11 +0000 Subject: [PATCH] web: make_url: Filter out any values that are None Signed-off-by: Michael Tremer --- src/web/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.47.2