Graham Dumpleton
grahamd at dscpl.com.au
Tue Nov 9 05:20:56 EST 2004
On 09/11/2004, at 9:08 PM, David Fraser wrote: > Graham Dumpleton wrote: > >> Can someone who uses mod_python on the Win32 platform, confirm for me >> what >> directory separator is used in req.uri and req.filename on Win32. >> >> On UNIX (POSIX) one would get something like: >> >> req.uri : /projects/vampire/index.html >> req.filename = >> /usr/local/etc/httpd/htdocs/projects/vampire/index.html >> >> I am presuming that on Win32, the URI still uses a forward slash, but >> that >> the filename will use backward slash in line with convention for >> platform >> and what os.path.sep is set to. Ie., >> >> req.uri : /projects/vampire/index.html >> req.filename = >> \usr\local\etc\httpd\htdocs\projects\vampire\index.html >> >> Is this correct, or does Apache normalise it to the POSIX convention >> on >> the Win32 platform? > > No, Apache normalises it to the POSIX convention (as is done in apache > config files): > req.uri: /demo/css/nounderlinelinks.css > req.filename: C:/Temp/jSuite.py/jLogbook/html/demo > (where my handler is set with SetHandler in the demo directory, thats > why its truncated) > Hope that helps Thanks, that does help. One more question though. Does the use of POSIX path conventions extend to other areas where a path might be defined internally by mod_python? For example, I use the following code to effectively determine the directory where the PythonHandler which applies to the request being serviced was set. if hasattr(req,"hlist"): # In mod_python 3.X have the req.hlist member. root = req.hlist.directory elif hasattr(req,"get_dirs"): # In mod_python 2.X have the req.get_dirs() method. root = req.get_dirs()["PythonHandler"] Is "root" going to also use POSIX path convention. This may depend more on how mod_python is implemented than Apache depending on how mod_python determines what value is used for this. -- Graham Dumpleton (grahamd at dscpl.com.au)
|