From: Raymond Hettinger Date: Sat, 10 Sep 2005 18:17:54 +0000 (+0000) Subject: Corrected version of 1.170 X-Git-Tag: v2.5a0~1394 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf6b6326e5844717954f9447ef1e307111f546d2;p=python Corrected version of 1.170 --- diff --git a/Lib/urllib.py b/Lib/urllib.py index a49b586592..bc16be0162 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.