[mod_python] Fixup hander not always being called

Michael C. Neel neel at mediapulse.com
Wed Mar 12 13:34:23 EST 2003


Sctratch the below.  It looks like the function apache.log_error()
doesn't always work, so my method of testing the handler was flawed.  I
used Sam Spade to watch headers, and my cookies are being added, even
though the calls to the error_log are not printing.

Also, I left off I'm using 2.7.8 on Apache 1.3.26

Thanks,
Mike

-----Original Message-----
From: Michael C. Neel 
Sent: Wednesday, March 12, 2003 10:57 AM
To: mod_python at modpython.org
Subject: [mod_python] Fixup hander not always being called


I have some mod perl code I'm trying to move over to modpython.  The
perl code adds a cookie header to all requests using the fixup phase,
and then logs some info in the logging phase.  When I setup python to do
the same, the fixup handler is not always called.  It looks like it is
related to cgi scripts, as when I hit a cgi page in the web browser, my
fixup handler is not called - but it will call the perl version.

My conf has:

    <Location />
        #SetHandler python-program
        PythonLogHandler qlog
        PythonFixupHandler qlog
        PythonDebug On
    </Location>

I've commented out the SetHandler because that would break cgi scripts
(causing the text of the script to be sent to the browser, instead of
executing it).  This is the same with mod_perl, you can't use the
SetHandler.

qlog.py (simplified):

from mod_python import apache

def fixuphandler(req):

    apache.log_error("----------- New Hit -----------")
    apache.log_error("CT: " + str(req.content_type))

def loghandler(req):

    apache.log_error("----------- Log Hit -----------")


Any insights?  I'd like to do the new version of this code in python,
and not perl, but I gotta get this cgi snafu solved.

Thanks,
Mike

_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://www.modpython.org/mailman/listinfo/mod_python




More information about the Mod_python mailing list