[mod_python] Re: How can I have sensible URLs?

David Higgs drh9296 at ritvax.rit.edu
Wed Sep 4 15:09:50 EST 2002


> I'm sure you can imagine that every script is doing a lot of stuff (printing
> out HTML forms, handling user actions and so on). - Let's see how I would
> implement this with mod_python:
> 
> - I would write one large mod_python script called "libdb.py" which contains
> basically the whole code of all the above listed scripts. Each of the above
> scripts I would replace by methods (handlers) like "def index():", "def
> input():", "def search():", etc.
> Then I've ended up with a huge, almost unmaintainable script.  :-(
> 
> Is there any way to avoid this?
> Would anyone tackle this problem differently?
> 
> Any help is greatly appreciated!
> Cheers, Peter

Have your root libdb.py do some error handling and parsing, and then 
execfile() the appropriate script for the request.  You can hide your 
scripts far away from the webserver directory for added security.

This might actually be what publisher does, but I haven't looked into it 
at all.

--david




More information about the Mod_python mailing list