summaryrefslogtreecommitdiff
path: root/AppPkg/Applications/Python/Python-2.7.2/Demo/cgi/cgi2.py
diff options
context:
space:
mode:
Diffstat (limited to 'AppPkg/Applications/Python/Python-2.7.2/Demo/cgi/cgi2.py')
-rw-r--r--AppPkg/Applications/Python/Python-2.7.2/Demo/cgi/cgi2.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Demo/cgi/cgi2.py b/AppPkg/Applications/Python/Python-2.7.2/Demo/cgi/cgi2.py
new file mode 100644
index 0000000000..1ed9f5501b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.2/Demo/cgi/cgi2.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+"""CGI test 2 - basic use of cgi module."""
+
+import cgitb; cgitb.enable()
+
+import cgi
+
+def main():
+ form = cgi.FieldStorage()
+ print "Content-type: text/html"
+ print
+ if not form:
+ print "<h1>No Form Keys</h1>"
+ else:
+ print "<h1>Form Keys</h1>"
+ for key in form.keys():
+ value = form[key].value
+ print "<p>", cgi.escape(key), ":", cgi.escape(value)
+
+if __name__ == "__main__":
+ main()