]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backporting urlparse.py:1.34, test_urlparse.py:1.8:
authorGuido van Rossum <guido@python.org>
Mon, 14 Oct 2002 20:08:50 +0000 (20:08 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 14 Oct 2002 20:08:50 +0000 (20:08 +0000)
Fix for 1.33: urlsplit() should only add '//' if scheme != ''.
[SF bug 620705]

Lib/test/test_urlparse.py
Lib/urlparse.py

index 7651afab85f7bd2bec7823cb36268af774a1b924..3ad49ef7f299b27c1677c7625692b07864712d73 100644 (file)
@@ -87,3 +87,8 @@ checkJoin('g/../h', 'http://a/b/c/h')
 #checkJoin('http:', 'http:')
 
 print errors, "errors"
+
+# One more test backported from 2.3
+for u in ['Python', './Python']:
+    if urlparse.urlunparse(urlparse.urlparse(u)) != u:
+        print "*** urlparse/urlunparse failure for", `u`
index 6361937a93191a23ae1c6ebcbcdf5c1e30beecb9..777b42f703735dce43b436ee08e8261e141104f7 100644 (file)
@@ -128,7 +128,7 @@ def urlunparse((scheme, netloc, url, params, query, fragment)):
     return urlunsplit((scheme, netloc, url, query, fragment))
 
 def urlunsplit((scheme, netloc, url, query, fragment)):
-    if netloc or (scheme in uses_netloc and url[:2] != '//'):
+    if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
         if url and url[:1] != '/': url = '/' + url
         url = '//' + (netloc or '') + url
     if scheme: