[Python-checkins] python/dist/src/Lib urllib.py,1.171,1.172

rhettinger@users.sourceforge.net rhettinger at users.sourceforge.net
Sat Sep 10 16:30:12 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16867

Modified Files:
	urllib.py 
Log Message:
Revert 1.170.  Add tests.

Index: urllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- urllib.py	10 Sep 2005 06:49:04 -0000	1.171
+++ urllib.py	10 Sep 2005 14:30:09 -0000	1.172
@@ -1110,9 +1110,12 @@
 def quote_plus(s, safe = ''):
     """Quote the query fragment of a URL; replacing ' ' with '+'"""
     if ' ' in s:
-        s = s.replace(' ', '+')
-        safe += '+'
-    return quote(s, safe)
+        l = s.split(' ')
+        for i in range(len(l)):
+            l[i] = quote(l[i], safe)
+        return '+'.join(l)
+    else:
+        return quote(s, safe)
 
 def urlencode(query,doseq=0):
     """Encode a sequence of two-element tuples or dictionary into a URL query string.



More information about the Python-checkins mailing list