From: Facundo Batista Date: Mon, 8 Sep 2008 00:20:28 +0000 (+0000) Subject: Issue 3801. Fixing a dumb error in the deprecated parse_qsl() X-Git-Tag: v2.6rc1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ace0bcf6690ccf042b20203325048f0b9fef85de;p=thirdparty%2FPython%2Fcpython.git Issue 3801. Fixing a dumb error in the deprecated parse_qsl() function. Tests added. --- diff --git a/Lib/cgi.py b/Lib/cgi.py index 373ba51fc1cc..33b91bfbd235 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -189,7 +189,7 @@ def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument.""" warn("cgi.parse_qsl is deprecated, use urlparse.parse_qsl instead", PendingDeprecationWarning) - return urlparse.parse_qs(qs, keep_blank_values, strict_parsing) + return urlparse.parse_qsl(qs, keep_blank_values, strict_parsing) def parse_multipart(fp, pdict): """Parse multipart input. diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py index 79bca4ee9a6e..fa1d37fceb85 100644 --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -344,6 +344,17 @@ this is the content of the fake file v = gen_result(data, environ) self.assertEqual(result, v) + def test_deprecated_parse_qs(self): + # this func is moved to urlparse, this is just a sanity check + self.assertEqual({'a': ['A1'], 'B': ['B3'], 'b': ['B2']}, + cgi.parse_qs('a=A1&b=B2&B=B3')) + + def test_deprecated_parse_qsl(self): + # this func is moved to urlparse, this is just a sanity check + self.assertEqual([('a', 'A1'), ('b', 'B2'), ('B', 'B3')], + cgi.parse_qsl('a=A1&b=B2&B=B3')) + + def test_main(): run_unittest(CgiTests)