[Python-checkins] r78270 - in python/branches/py3k: Lib/test/test_urllib.py Lib/urllib/request.py

senthil.kumaran python-checkins at python.org
Sat Feb 20 23:19:04 CET 2010


Author: senthil.kumaran
Date: Sat Feb 20 23:19:04 2010
New Revision: 78270

Log:
Merged revisions 78268 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk



Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_urllib.py
   python/branches/py3k/Lib/urllib/request.py

Modified: python/branches/py3k/Lib/test/test_urllib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_urllib.py	(original)
+++ python/branches/py3k/Lib/test/test_urllib.py	Sat Feb 20 23:19:04 2010
@@ -112,7 +112,6 @@
         for line in self.returned_obj.__iter__():
             self.assertEqual(line, self.text)
 
-
 class ProxyTests(unittest.TestCase):
 
     def setUp(self):
@@ -866,6 +865,11 @@
         self.assertEqual(DummyURLopener().open(
             'spam://example/ /'),'//example/%20/')
 
+        # test the safe characters are not quoted by urlopen
+        self.assertEqual(DummyURLopener().open(
+            "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"),
+            "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/")
+
 # Just commented them out.
 # Can't really tell why keep failing in windows and sparc.
 # Everywhere else they work ok, but on those machines, someteimes

Modified: python/branches/py3k/Lib/urllib/request.py
==============================================================================
--- python/branches/py3k/Lib/urllib/request.py	(original)
+++ python/branches/py3k/Lib/urllib/request.py	Sat Feb 20 23:19:04 2010
@@ -1426,7 +1426,7 @@
     def open(self, fullurl, data=None):
         """Use URLopener().open(file) instead of open(file, 'r')."""
         fullurl = unwrap(to_bytes(fullurl))
-        fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]")
+        fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|")
         if self.tempcache and fullurl in self.tempcache:
             filename, headers = self.tempcache[fullurl]
             fp = open(filename, 'rb')


More information about the Python-checkins mailing list