[mod_python] SetHandler trick to have pretty url's

courtney ludwin courtneyludwin at yahoo.com
Tue Jan 10 01:52:05 EST 2006


I was looking for a way to pretty up my mod_python
url's the other day and I figured out a trick that
works w/ the 'FilesMatch' directive in httpd.conf, I
figure I'd share with the list....

 <FilesMatch "(^[^\.]*$|^[^\?]*[\?]+[^$]+$)">
    SetHandler python-program
    PythonHandler common.dispatch.dispatcher
    PythonDebug On
  </FilesMatch>

This match expression says anything without a file
extension should be handled by dispatcher.py otherwise
apache should handle it normally.  I wrote the
dispatcher use a config file to map url's to
mod_python handlers.

Followed up a quick example in my blog:
http://2centspoorer.blogspot.com/2006/01/creating-your-own-modpython-request.html

Hope you find it useful.

Thanks,
Courtney


		
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 



More information about the Mod_python mailing list