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

Graham Dumpleton grahamd at dscpl.com.au
Wed Nov 10 17:44:26 EST 2004

On Nov 10 17:32, David Fraser <davidf at sjsoft.com> wrote:
> Subject: Re: [mod_python] Directory separator in uri/filename on Win32.
> Graham Dumpleton wrote:
> > 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.
> Ran this on my Windows machine: displayed the following in my browser:
> C:/Temp/jSuite.py/jLogbook/html/pubtest/\
> Not sure what the extra \ is for

I have mentioned the possible reason for the extra '\' in separate email,
but I guess that the only thing I would want to clarify was in what way
was the PythonHandler directive set up.

If it was done in a .htaccess file, then Apache is probably creating the
handler path all by itself. If the httpd.conf file was used and someone
used '\' within the name of the directory governing the PythonHandler
directive, does Apache always force it back to POSIX naming convention.

In other words, if the httpd.conf directive was set as:

    <Directory C:\Temp\jSuite.py\jLogbook\html\pubtest>
    SetHandler mod_python
    PythonHandler mod_python.publisher

does it still come through as POSIX convention. That is presuming that
Apache on Win32 will accept both Win32 and POSIX style names in the
config file in the first place.

After the clarification as mail didn't say that I could see whether the
Directory directive used a POSIX or Win32 naming convention in the
first place.

BTW, do you really have a directory called "jSuite.py" as this suggests?
I thought this would have been mightly confusing given Python uses
that extension on files. :-)

Graham Dumpleton (grahamd at dscpl.com.au)

More information about the Mod_python mailing list