[mod_python] Directory separator in uri/filename on Win32.

Graham Dumpleton grahamd at dscpl.com.au
Wed Nov 10 03:24:25 EST 2004


On 09/11/2004, at 9:20 PM, Graham Dumpleton wrote:

>
>> 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.

Is anyone able to run the check for me to answer my extra question about
what the handler directory is set to on Win32 platform? Ie., 
confirmation
that it also still uses POSIX directory separate convention and not 
Win32.

The required publisher code is:

def index(req):

   root = "???"

   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"]

   return root

Thanks in advance.



--
Graham Dumpleton (grahamd at dscpl.com.au)



More information about the Mod_python mailing list