[mod_python] getting started

Anthony Barker anthony_barker at hotmail.com
Wed Oct 8 17:22:15 EST 2003

I was wondering how to get started processing an html form.

1) is there something equivalent to Apache::PerlRun?

"This module does not cache compiled scripts between runs.
A script is loaded and compiled freshly each time it is requested.
However, Apache::PerlRun still avoids the overhead of starting a new Perl
interpreter for each CGI script, so it's faster than traditional Perl CGI
scripting but slower than Apache::Registry or vanilla Apache API modules."

2) How would mod_python enable this simple script?

import cgi, sys, string
sys.stderr = sys.stdout
print "Content-type: text/html\r\n"

out1 = """
<BODY BGCOLOR = white>
<H3>Please, enter your name and age.</H3>
<FORM METHOD = post ACTION = "t3.cgi">
<INPUT type = text name = "name"></TD>
<INPUT TYPE = hidden NAME = "action" VALUE = "display"
<INPUT TYPE = submit VALUE = "Enter">

form = cgi.FieldStorage()
if form.has_key("action"):
    if form.has_key("name"):
        print "hello " + form["name"].value
    print out1

Instant message in style with MSN Messenger 6.0. Download it now FREE!  

More information about the Mod_python mailing list