changeset: 81025:727f26d1806f branch: 3.3 parent: 81020:0b1a49f99169 parent: 81024:d002a2e46383 user: Senthil Kumaran date: Mon Dec 24 14:01:13 2012 -0800 files: Misc/NEWS description: Fix issue16713 - tel url parsing with params diff -r 0b1a49f99169 -r 727f26d1806f Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py Mon Dec 24 20:06:52 2012 +0200 +++ b/Lib/test/test_urlparse.py Mon Dec 24 14:01:13 2012 -0800 @@ -818,6 +818,35 @@ p2 = urllib.parse.urlsplit('tel:+31641044153') self.assertEqual(p2.scheme, 'tel') self.assertEqual(p2.path, '+31641044153') + # assert the behavior for urlparse + p1 = urllib.parse.urlparse('tel:+31-641044153') + self.assertEqual(p1.scheme, 'tel') + self.assertEqual(p1.path, '+31-641044153') + p2 = urllib.parse.urlparse('tel:+31641044153') + self.assertEqual(p2.scheme, 'tel') + self.assertEqual(p2.path, '+31641044153') + + def test_telurl_params(self): + p1 = urllib.parse.urlparse('tel:123-4;phone-context=+1-650-516') + self.assertEqual(p1.scheme, 'tel') + self.assertEqual(p1.path, '123-4') + self.assertEqual(p1.params, 'phone-context=+1-650-516') + + p1 = urllib.parse.urlparse('tel:+1-201-555-0123') + self.assertEqual(p1.scheme, 'tel') + self.assertEqual(p1.path, '+1-201-555-0123') + self.assertEqual(p1.params, '') + + p1 = urllib.parse.urlparse('tel:7042;phone-context=example.com') + self.assertEqual(p1.scheme, 'tel') + self.assertEqual(p1.path, '7042') + self.assertEqual(p1.params, 'phone-context=example.com') + + p1 = urllib.parse.urlparse('tel:863-1234;phone-context=+1-914-555') + self.assertEqual(p1.scheme, 'tel') + self.assertEqual(p1.path, '863-1234') + self.assertEqual(p1.params, 'phone-context=+1-914-555') + def test_main(): support.run_unittest(UrlParseTestCase) diff -r 0b1a49f99169 -r 727f26d1806f Lib/urllib/parse.py --- a/Lib/urllib/parse.py Mon Dec 24 20:06:52 2012 +0200 +++ b/Lib/urllib/parse.py Mon Dec 24 14:01:13 2012 -0800 @@ -46,7 +46,7 @@ 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh'] uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', - 'mms', '', 'sftp'] + 'mms', '', 'sftp', 'tel'] # These are not actually used anymore, but should stay for backwards # compatibility. (They are undocumented, but have a public-looking name.) diff -r 0b1a49f99169 -r 727f26d1806f Misc/NEWS --- a/Misc/NEWS Mon Dec 24 20:06:52 2012 +0200 +++ b/Misc/NEWS Mon Dec 24 14:01:13 2012 -0800 @@ -117,6 +117,9 @@ - Issue #16511: Use default IDLE width and height if config param is not valid. Patch Serhiy Storchaka. +- Issue #16713: Parsing of 'tel' urls using urlparse separates params from + path. + - Issue #16443: Add docstrings to regular expression match objects. Patch by Anton Kasyanov.