[mod_python] Mapping a URI to pages dynamically.

PhilipJägenstedt philipj at telia.com
Mon May 19 18:53:11 EST 2003


> I chose option #4: Build your own.

It's interresting that you should say that, because I eventually came to
the same conclusion. It took a litter longer for me to invent (because
the last thing in the URI can be either a "group" or "node", which takes
some code to figure out which). Anyway, it's just 16 lines long, so that
feels better than importing quixote modules or something.

However, there is one flaw which it sounds you may have overcome. Since
I have DirectoryIndex index.py for my / on the server, just writing
http://site.org/ gives me a URI of /index.py. I resolve this by checking
if the last (and only!) element of the URI is the same as the filename
of the executing script. The downside is that it makes it impossible to
have a group or node called "index.py". Also, because I have my css in
the root (A special exception from the SetHandler python-progam is made
for the css file), no node can be called "stdb.css" Nor can I have a
"lib" node or dir, because of the "lib" dir containing all the modules
of my application.

You get the point... in practice, this isn't a very big problem, but
it's just not clean -- I'd like to get around it. So the question: does

> I just have /xx scriptaliased to point to a single .py handler.

mean that you use SetHandler python-program for entire dir, or are you
doing something smarter that might help me evade the issues I'm having?

// Philip Jägenstedt


More information about the Mod_python mailing list