[mod_python] PythonAuthzHandler not working

Jim Gallacher jpg at jgassociates.ca
Thu Apr 20 19:33:20 EDT 2006

I've been pulling my hair out all day trying to get PythonAuthzHandler 
to work and I'm either missing something obvious or there is a problem 
with mod_python. What the heck is the magic required to make Apache call 
my authzhander? Using Apache 2.0.55 with the latest 3.3.0-dev, all my 
handlers including authenhandler get called, *except* for authzhandler.

<Directory /srv/projects/aos/html/aos-admin/>
   DirectoryIndex index.py
   AllowOverride None
   AddHandler mod_python .py

   AuthType PyCookie
   AuthName "Restricted"
   Require valid-user
   Require admin

   PythonAccessHandler mprest.authtest
   PythonAuthenHandler mprest.authtest
   PythonAuthzHandler mprest.authtest
   PythonHandler mprest.authtest


authtest.py contains the appropriate handlers that do nothing more than 
call req.log_error().

To aid in my efforts I modified python_handler in mod_python.c to log 
the status of each phase.

Simplified error_log output:

$ cut -f 4 -d "]"  error.log
mod_python.c python_handler: DECLINED PythonInitHandler phase
mod_python.c python_handler: DECLINED PythonPostReadRequestHandler phase
mod_python.c python_handler: DECLINED PythonTransHandler phase
mod_python.c python_handler: DECLINED PythonHeaderParserHandler phase
mod_python.c python_handler: PROCESS  PythonAccessHandler phase
authtest.py  accesshandler called
mod_python.c python_handler: PROCESS  PythonAuthenHandler phase
authtest.py  authenhandler called
mod_python.c python_handler: DECLINED PythonFixupHandler phase
mod_python.c python_handler: PROCESS  PythonHandler phase
authtest.py  handler called
mod_python.c python_handler: DECLINED PythonLogHandler phase
mod_python.c python_handler: DECLINED PythonCleanupHandler phase

Please save me before I've gone completely bald. Otherwise at that point 
I'll have to start poking myself with a pointed stick. Madness can't be 
too far off in my future. :)


More information about the Mod_python mailing list