bwhiteley at novell.com
Wed Mar 1 15:19:33 EST 2006
In order to generate hyperlinks, I need a reliable way to determine the script name while using the publisher handler. I hunted around for a bit, and only found this from years ago that wasn't answered: http://www.modpython.org/pipermail/mod_python/2003-September/014133.html I was doing this for a while: req.uri[:-len(req.path_info)] This worked until I renamed my script to index.py, then it fell apart. So, I guess what I really need is not the script name, but the portion of the URI prior to the method name. In some cases this might be the script name (possibly without the '.py'). In the case of index.py, it might be the folder containing index.py. As an example, I've set up a script loosely based on hello.py: http://modpython.org/live/current/doc-html/hand-pub-intro.html I place it in /srv/www/htdocs/mptest/index.py (docroot is /srv/www/htdocs). When I access it like this: http://www/mptest/say/hello, I see the following vars: SCRIPT_FILENAME /srv/www/htdocs/mptest/say PATH_INFO /hello SCRIPT_NAME /mptest/say In this example, I'd like to isolate "/mptest". Does anyone have a way to reliable isolate the script name, or the folder containing index.py?