From 458120dd40db6b4df55a4e96b650e16798ef06a0 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 3 May 2011 11:25:13 +0000 Subject: add hg and python --- sys/src/cmd/python/Demo/cgi/cgi2.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 sys/src/cmd/python/Demo/cgi/cgi2.py (limited to 'sys/src/cmd/python/Demo/cgi/cgi2.py') diff --git a/sys/src/cmd/python/Demo/cgi/cgi2.py b/sys/src/cmd/python/Demo/cgi/cgi2.py new file mode 100755 index 000000000..d956f6538 --- /dev/null +++ b/sys/src/cmd/python/Demo/cgi/cgi2.py @@ -0,0 +1,22 @@ +#!/usr/local/bin/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 "

No Form Keys

" + else: + print "

Form Keys

" + for key in form.keys(): + value = form[key].value + print "

", cgi.escape(key), ":", cgi.escape(value) + +if __name__ == "__main__": + main() -- cgit v1.2.3