[mod_python] DefaultHandler and DirectoryIndex

Craig Warren craig.warren at encorp.com
Thu Dec 23 13:18:58 EST 2004

I have been using mod_python for a few months now, and it is working

I was wondering if there is a way to call a default handler and/or a
DirectoryIndex handler?

I have few directories that I have set the handler to mod_python and
every request that comes in, goes through my handler.  I do this because
I pass the request through a "authentication" handler (mod_webauth)
first (it looks at a cookie that I set when the user logs in) and if not
valid then redirects them to a login page, if not it passes the request
to either mod_python.psp or for now to another handler that I wrote that
just servers up the file (mod_webauth.default)
Here is my configuration below

<Directory ~  "^/var/www/html/(main|admin|webapi)">
      SetHandler mod_python 
      PythonHandler mod_webauth.authen mod_python.psp|.psp
      PythonHandler mod_webauth.authen mod_python.publisher|.py
      PythonHandler mod_webauth.authen mod_webauth.default 
      PythonDebug On
      PythonOption PSPDbmCache "/tmp/pspcache.dbm"	  
      PythonOption  ApplicationPath '/'
      PythonOption DBPath '/tmp/authen.db'

If I didn't have the mod_webauth.default the request never gets server. 
If the user goes to the directory, my default handler could return a
directory listing, but if there is a way to call the DirectoryIndex
handler after it goes through my mod_webauth.authen handler, then I
wouldn't have to write the code, same thing for serving all other files,
like png's,gif's,css's...I would like to call Apache's default handler.

Is there any way to do that?  I have looked around and haven't seen any
handlers or ways do call other handlers after I call my handler.

I really like how you the request go through multiple handlers!


Craig Warren
Senior Programmer	
craig.warren at encorp.com

More information about the Mod_python mailing list