CGI Flashcards

1
Q

extract variables from forms

A

import cgi
form = cgi.FieldStorage()
r = form.getvalue(“r”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

required opening of all CGI script with output

A

print “Content-type: text/html\n”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

specify the interpreter explicitly

A

!/store/bin/python

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

check for form value

A

if form.getvalue(“r”) is not Note:

if “mailaddress” in form

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

nicely formatted errors

A

import cgitb; cgitb.enable()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Run CGI script from command line

A

export QUERY_STRING=”r=1.4”
./hw2.py.cgi > index.html
cat index.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly