summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-09-10 18:17:54 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-09-10 18:17:54 (GMT)
commitcf6b6326e5844717954f9447ef1e307111f546d2 (patch)
tree34e2902edac9ec9b1d5766a7894a28579d859495
parent2bdec7bfb0b200db64c7170c0aebdf2aa5356167 (diff)
downloadcpython-cf6b6326e5844717954f9447ef1e307111f546d2.zip
cpython-cf6b6326e5844717954f9447ef1e307111f546d2.tar.gz
cpython-cf6b6326e5844717954f9447ef1e307111f546d2.tar.bz2
Corrected version of 1.170
-rw-r--r--Lib/urllib.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index a49b586..bc16be0 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -1110,12 +1110,9 @@ def quote(s, safe = '/'):
def quote_plus(s, safe = ''):
"""Quote the query fragment of a URL; replacing ' ' with '+'"""
if ' ' in s:
- l = s.split(' ')
- for i in range(len(l)):
- l[i] = quote(l[i], safe)
- return '+'.join(l)
- else:
- return quote(s, safe)
+ s = quote(s, safe + ' ')
+ return s.replace(' ', '+')
+ return quote(s, safe)
def urlencode(query,doseq=0):
"""Encode a sequence of two-element tuples or dictionary into a URL query string.