From: Andy Anderson Date: Wed, 19 Apr 2017 15:43:43 +0000 (-0500) Subject: fix backwards compatibility of url_concat for args=None X-Git-Tag: v4.5.1~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86cc31f52992fb9d11f92de6fd5496842fea2265;p=thirdparty%2Ftornado.git fix backwards compatibility of url_concat for args=None --- diff --git a/tornado/httputil.py b/tornado/httputil.py index dc206fc8c..818ea914c 100644 --- a/tornado/httputil.py +++ b/tornado/httputil.py @@ -603,6 +603,8 @@ def url_concat(url, args): >>> url_concat("http://example.com/foo?a=b", [("c", "d"), ("c", "d2")]) 'http://example.com/foo?a=b&c=d&c=d2' """ + if args is None: + return url parsed_url = urlparse(url) if isinstance(args, dict): parsed_query = parse_qsl(parsed_url.query, keep_blank_values=True) diff --git a/tornado/test/httputil_test.py b/tornado/test/httputil_test.py index 5249eadde..d1278567b 100644 --- a/tornado/test/httputil_test.py +++ b/tornado/test/httputil_test.py @@ -66,6 +66,13 @@ class TestUrlConcat(unittest.TestCase): ) self.assertEqual(url, "https://localhost/path?r=1&t=2") + def test_url_concat_none_params(self): + url = url_concat( + "https://localhost/path?r=1&t=2", + None, + ) + self.assertEqual(url, "https://localhost/path?r=1&t=2") + def test_url_concat_with_frag(self): url = url_concat( "https://localhost/path#tab",