Python CGI

jbrewer jeremy.d.brewer at gmail.com
Thu Dec 1 05:52:01 CET 2005


I need to update a CGI script I have been working on to perform
validation of input files.  The basic idea is this:

1.) HTML page is served
2.) User posts file and some other info
3.) Check file for necessary data
    * If data is missing, then post a 2nd page requesting needed data
    * If data is present, continue to 4
4.) Process input file and display results (processing path depends on
whether data from 3 was present in file or had to be input by user)

I'm unsure of the best way to implement step 3.  Is it even possible to
put all of this into one script?  Or should I have one script check the
file for the data, then pass the info on to a 2nd script?  The
cgi.FieldStorage() function should only be called once, so it seems
like it's not possible to read a form and then repost another one and
read it.  If this is true and I need 2 scripts, how do I pass on the
information in step 3 automatically if the file has the proper data and
no user input is needed?

Sorry if this is a dumb question (or unclear), but this is my
(ever-growing) first CGI script.  Thanks.
Jeremy




More information about the Python-list mailing list