Reinhold, Thanks for responding...
I see that you are using Python 2.4.1 and the bug was against 2.4. (I am now using 2.4.1) If I remember correctly there were two issues that I ran into, one was with a missing REQUEST_METHOD and the other was with a INCORRECT request method. As per your example the missing one does not seem to be a problem any longer. The incorrect REQUEST_METHOD setting still seems to be an issue with Python 2.4.1. Make the following changes to your code to demonstrate that problem. import cgi import os # NEW os.environ['REQUEST_METHOD'] = 'cgi' # NEW field = cgi.FieldStorage() print field print field.keys() # NEW Run the program now with NO parameters. (I'm running on WinXP SP2). After you start the program cgi.py will be reading from stdin. type "a=1" and hit enter type "b=2" and hit enter press ctrl-z (to send eof) and hit enter You will get the following stack trace. FieldStorage(None, None, 'a=1\nb=2\n') Traceback (most recent call last): File "H:\1\t2.py", line 12, in ? print field.keys() File "P:\SW\Python\lib\cgi.py", line 601, in keys TypeError: not indexable When the environment does not have a correctly set REQUEST_METHOD cgi.py prompts for key=value pairs by reading from sys.stdin. (as demonstrated above) I realize REQUEST_METHOD should be set properly but hear me out. After the values are read from sys.stdin they are never stored in the FieldStorage.list attribute like they are when the FieldStorage.read_urlencoded or FieldStorage.read_multi methods are called. The read_single method is the one that has the problem (it is inconsistenty with the other two methods because it doesn't store the values like the other two methods do). This causes a problem when FieldStorage.keys() is called because although the values were read from sys.stdin they were never stored in FieldStorage.list. Although you could argue that REQUEST_METHOD should have been set correctly in the first place, it still seems like if cgi.py is going to handle that situation of a invalid REQUEST_METHOD by actually reading the values from sys.stdin (it already does this part) it should store them too (especially since it does store the values in the other two methods). Does that explain the issue more clearly? "Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Joe wrote: >> Back in March I submitted a patch for cgi.py to sourceforge to fix a >> problem >> with the handling of an invalid REQUEST_METHOD. >> >> I thought I followed all the steps to properly submit the bug and patch >> but >> the patch is still sitting there in limbo. >> >> This is the first patch I have submitted for Python, did I miss a step in >> the patch process? >> >> What else needs to be done? > > Can you provide an example script demonstrating the problem you describe? > > I tried something like this (Py2.4.1): > > ------- test_cgi.py > #!/bin/env python > import cgi > fs = cgi.FieldStorage() > print fs > > $ python test_cgi.py "a=1&b=2" > FieldStorage(None, None, [MiniFieldStorage('a', '1'), > MiniFieldStorage('b', '2')]) > $ > > There's no REQUEST_METHOD or QUERY_STRING env var set. > > Reinhold -- http://mail.python.org/mailman/listinfo/python-list