summaryrefslogtreecommitdiffstats
path: root/Lib/cgi.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2004-03-21 22:16:15 (GMT)
committerBrett Cannon <bcannon@gmail.com>2004-03-21 22:16:15 (GMT)
commit8d9b60f1023009d3b621f31516e429ace297946b (patch)
tree3ccfc79ecdc4ff9d77d81089498533284e6fc64b /Lib/cgi.py
parentcbddabfd85a88356abf8bcfd582724ebb86cd2ad (diff)
downloadcpython-8d9b60f1023009d3b621f31516e429ace297946b.zip
cpython-8d9b60f1023009d3b621f31516e429ace297946b.tar.gz
cpython-8d9b60f1023009d3b621f31516e429ace297946b.tar.bz2
Change parse_qsl() to accept control-name's with no equal sign (e.g., "name")
when keep_blank_values is true.
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-xLib/cgi.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 2576e75..487b01e 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -213,7 +213,11 @@ def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
if len(nv) != 2:
if strict_parsing:
raise ValueError, "bad query field: %r" % (name_value,)
- continue
+ # Handle case of a control-name with no equal sign
+ if keep_blank_values:
+ nv.append('')
+ else:
+ continue
if len(nv[1]) or keep_blank_values:
name = urllib.unquote(nv[0].replace('+', ' '))
value = urllib.unquote(nv[1].replace('+', ' '))