Last change
on this file was 391, checked in by dmik, 11 years ago |
python: Merge vendor 2.7.6 to trunk.
|
-
Property svn:eol-style
set to
native
|
File size:
470 bytes
|
Rev | Line | |
---|
[391] | 1 | #!/usr/bin/env python
|
---|
[2] | 2 |
|
---|
| 3 | """CGI test 2 - basic use of cgi module."""
|
---|
| 4 |
|
---|
| 5 | import cgitb; cgitb.enable()
|
---|
| 6 |
|
---|
| 7 | import cgi
|
---|
| 8 |
|
---|
| 9 | def main():
|
---|
| 10 | form = cgi.FieldStorage()
|
---|
| 11 | print "Content-type: text/html"
|
---|
| 12 | print
|
---|
| 13 | if not form:
|
---|
| 14 | print "<h1>No Form Keys</h1>"
|
---|
| 15 | else:
|
---|
| 16 | print "<h1>Form Keys</h1>"
|
---|
| 17 | for key in form.keys():
|
---|
| 18 | value = form[key].value
|
---|
| 19 | print "<p>", cgi.escape(key), ":", cgi.escape(value)
|
---|
| 20 |
|
---|
| 21 | if __name__ == "__main__":
|
---|
| 22 | main()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.