CGI FieldStorage instances?

Gnarlodious gnarlodious at gmail.com
Sun Nov 21 02:19:06 CET 2010


I'm having a hard time understanding this, can someone explain?

Running a CGI with query string:

?action=Find&page=Data

Script includes these lines:

form=cgi.FieldStorage(keep_blank_values=1)
print("Content-type:text/html\n\n")
print(cgi.print_form(form))

Output:

Form Contents:

action: <class 'cgi.MiniFieldStorage'>
MiniFieldStorage('action', 'Find')
page: <class 'cgi.MiniFieldStorage'>
MiniFieldStorage('page', 'Data')


It looks like every variable in the query string instantiates a
MiniFieldStorage with that value, is that the case? And if so, what
sort of cool tricks could I do with that feature? Because so far I am
doing CGI and it is a big old mess. Intercepting every variable is
complicated and confusing. Is there an easier way?

-- Gnarlie



More information about the Python-list mailing list