]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
fix backwards compatibility of url_concat for args=None 2018/head
authorAndy Anderson <andy.anderson@cloudimperiumgames.com>
Wed, 19 Apr 2017 15:43:43 +0000 (10:43 -0500)
committerAndy Anderson <andy.anderson@cloudimperiumgames.com>
Wed, 19 Apr 2017 15:58:33 +0000 (10:58 -0500)
tornado/httputil.py
tornado/test/httputil_test.py

index dc206fc8cba6b489beb0f647dcb1c75ab7455a4e..818ea914cb4cd73f4ae89afc97bd09af89de924f 100644 (file)
@@ -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)
index 5249eadde51a78da876a4474d7acec24a123d2dd..d1278567bbcd4c3c770620d8b6dfd20b4069b20f 100644 (file)
@@ -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",