[mod_python] Chaining handlers

David Champion dgc at uchicago.edu
Mon Mar 24 00:40:53 EDT 2008


> Without seeing your Apache configuration for setting up the handlers
> and the code of the actual handlers, can't really say why you may be
> having a problem.

I get the same results without any of my own authN code.  It seems to be
some really basic issue with mod_python or my use of it.

unix$ tail -7 httpd.conf
<Location /test>
    PythonDebug On
    SetHandler mod_python

    PythonHeaderParserHandler Example::handler
    PythonPath "sys.path + ['/home/dgc/lib/python']"
</Location>

unix$ cat Example.py
from mod_python import apache

def handler(req):
        return apache.DECLINED

unix$ cat <<XXX >/httpd/test/env.cgi
#!/usr/bin/python

import sys
import os
import cgi
import cgitb

def main():
    print "Content-Type: text/html"
    print
    cgi.print_environ()

if not os.isatty(0):
    cgitb.enable()
if __name__ == "__main__":
    main()
XXX

Loading http://server/test/env.cgi in a browser dumps the text of the
CGI script to me as Content-type: text/html.  Without the <Location/>
block, it works as a CGI should.

-- 
 -D.    dgc at uchicago.edu    NSIT    University of Chicago


More information about the Mod_python mailing list