[Python-bugs-list] [Bug #129788] cgi module. FieldStorage class returns keys blank fields.

noreply@sourceforge.net noreply@sourceforge.net
Sun, 28 Jan 2001 18:59:39 -0800


Bug #129788, was updated on 2001-Jan-23 01:28
Here is a current snapshot of the bug.

Project: Python
Category: Python Library
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: nobody
Assigned to : akuchling
Summary: cgi module. FieldStorage class returns keys blank fields.

Details: In module cgi.py

The FieldStorage class returns keys for blank values even though the
keep_blank_values property is set to 0

The problem lies in the parse_qsl method.
The second last line of the function
  r.append((name, value))
should read
  if (len(value) or keep_blank_values):
      r.append((name, value))  

I hope this can be corrected.

Thanks

Follow-Ups:

Date: 2001-Jan-28 18:59
By: nobody

Comment:
I don't see why this is necessary.  The r.append()
call is inside an if block whose condition is
'if len(nv[1]) or keep_blank_values'.  nv[1] then has + replaced with space
characters and is run through
urllib.unquote().  I'm unable to see how a non-empty string could result in
an empty string after urllib.unquote, and in fact
cgi.parse_qsl('abc=&foo=bar') returns [('foo', 'bar')].  Can you provide a
test case?

If a test case demonstrating the problem doesn't appear, this bug should be
marked as 'Not a bug' and cgi.py left alone.
-------------------------------------------------------

Date: 2001-Jan-26 07:29
By: fdrake

Comment:
Assigned to Andrew since he knows more about CGI stuff than I ever expect
to.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=129788&group_id=5470