[mod_python] How do I split up the URI in a request handler?

Paul Moore pf_moore at yahoo.co.uk
Mon Jun 7 00:20:46 EDT 2004

In section 3.3 of the manual, at the end ("Some food for thought"), it
points out that the name of the Python file in the URL
http://myserver/mywebdir/myscript.py is not relevant to what Python
function gets called. I understand that, and I see that the handler
needs to parse the URL in order to get access to the filename
"myscript.py" should I require it for any reason.

The req.uri attribute gives me "/mywebdir/myscript.py". But how do I
find that my handler is being called "from" /mywebdir, to know how
much of the URI to strip off the front?

It seems to me that this is a pretty basic requirement for URI
parsing, so I'm assuming that I am missing something straightforward.
But for the life of me, I can't see it :-( This is causing a problem
for me in the mod_python support in MoinMoin, so I'd appreciate any

This signature intentionally left blank

More information about the Mod_python mailing list