[Python-Dev] [Python-checkins] python/dist/src/Lib urllib.py, 1.169, 1.170 (original) (raw)
Peter Otten __peter__ at web.de
Sat Sep 10 09:22:59 CEST 2005
- Previous message: [Python-Dev] [draft] python-dev Summary for 2005-08-16 through 2005-08-31
- Next message: [Python-Dev] unintentional and unsafe use of realpath()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am Samstag, 10. September 2005 04:27 schrieb rhettinger at users.sourceforge.net:
Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3622
Modified Files: urllib.py Log Message: Simplify and speed-up quoteplus(). Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.169 retrieving revision 1.170 diff -u -d -r1.169 -r1.170 --- urllib.py 9 Sep 2005 22:27:13 -0000 1.169 +++ urllib.py 10 Sep 2005 02:27:41 -0000 1.170 @@ -1115,12 +1115,9 @@ def quoteplus(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 = s.replace(' ', '+') + safe += '+' + return quote(s, safe) def urlencode(query,doseq=0): """Encode a sequence of two-element tuples or dictionary into a URL query string.
You also change the behaviour. Before:
urllib.quoteplus("alpha+beta gamma") 'alpha%2Bbeta+gamma'
After:
urllib.quoteplus("alpha+beta gamma") 'alpha+beta+gamma'
Is that intentional? If so, you also have to update the documentation, which currently reads:
quote_plus(string[, safe])
... Plus signs in the original string are escaped unless they are included in safe. ...
Peter
- Previous message: [Python-Dev] [draft] python-dev Summary for 2005-08-16 through 2005-08-31
- Next message: [Python-Dev] unintentional and unsafe use of realpath()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]