CGI Flashcards
1
Q
extract variables from forms
A
import cgi
form = cgi.FieldStorage()
r = form.getvalue(“r”)
2
Q
required opening of all CGI script with output
A
print “Content-type: text/html\n”
3
Q
specify the interpreter explicitly
A
!/store/bin/python
4
Q
check for form value
A
if form.getvalue(“r”) is not Note:
if “mailaddress” in form
5
Q
nicely formatted errors
A
import cgitb; cgitb.enable()
6
Q
Run CGI script from command line
A
export QUERY_STRING=”r=1.4”
./hw2.py.cgi > index.html
cat index.html