summaryrefslogtreecommitdiff
path: root/Lib/urllib.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-09-10 14:30:09 +0000
committerRaymond Hettinger <python@rcn.com>2005-09-10 14:30:09 +0000
commit9cd36a5669d2d59d7178ce0427e24e2ecb301f3b (patch)
treeaa2891b0241787c5ea223183a5a416756b724897 /Lib/urllib.py
parent9e99e35df5cb909c8c5db70df043d12abd420c90 (diff)
downloadcpython-9cd36a5669d2d59d7178ce0427e24e2ecb301f3b.tar.gz
Revert 1.170. Add tests.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 113b828dc6..a49b586592 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.