diff options
author | Raymond Hettinger <python@rcn.com> | 2005-09-10 14:30:09 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-09-10 14:30:09 (GMT) |
commit | 2bdec7bfb0b200db64c7170c0aebdf2aa5356167 (patch) | |
tree | 6382e769b89b016697fc81011b5d5da987dad8c1 /Lib/urllib.py | |
parent | 803ce801ab84c2e11a99dc160512cd905c0b6520 (diff) | |
download | cpython-2bdec7bfb0b200db64c7170c0aebdf2aa5356167.zip cpython-2bdec7bfb0b200db64c7170c0aebdf2aa5356167.tar.gz cpython-2bdec7bfb0b200db64c7170c0aebdf2aa5356167.tar.bz2 |
Revert 1.170. Add tests.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 113b828..a49b586 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -1110,9 +1110,12 @@ def quote(s, safe = '/'): 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. |