[mod_python] test doesn't work (solved?)

Dave dwallace at delanet.com
Sun Jun 25 08:41:23 EST 2000


I've been using the Location directive for a bit now, here is how it
looks for me:

<Location /wpy >
  SetHandler python-program
  PythonDebug On
  PythonPath "sys.path+['/devel/WEB/Webware/WebKit']"
  PythonHandler webkit_handler
</Location>

The key here is the undocumented feature of PythonPath that it
apparently evals its argument. I've been meaning to ask about this since
at some point this could get broken in development and I'd be up a
creek. This is certainly handy but what isn't nice is that I suppose
/something/wpy is also being appended to the PYTHONPATH wether I want or
not.  Maybe a directive to append paths to the default PYTHONPATH would
be in order?

BTW, the nice thing about using Location is the fact that for the
particular application I'm using there is only a single handler and all
content is delivered through that handler by the application. Having to
specify a Directory just doesn't seem quite right.

Dave.

On Fri, 23 Jun 2000, Gregory Trubetskoy wrote:

>On Thu, 22 Jun 2000, Miguel Marques wrote:

>> But note that when using a Location directive it still does not work.

>> e.g.
>> <Location "/test">
>>     AddHandler python-program .py
>>     PythonHandler test
>>     PythonDebug on
>> </Location>
>>
>> Is this intentional?

>I don't know if "intentional" is the right word, but it _is_ expected
>behaviour.

>mod_python prepends the directory to pythonpath, as outlined here:
>http://www.modpython.org/live/mod_python-2.4/doc/pythonapi.html#handler

>The <Location> directive puts whatever is specified as the argument to
it
>as the "directory", and mod_python ends up prependind it. But since
>"/test" is not a real directory, it doesn't do you any good. I don't
think
>there is a simple way to find out what the real directory is from
><Location>. If you read the Apache documentation for it, it puts the
>emphasis on the fact that <Location> is not in any way linked to the
>filesystem.





More information about the Mod_python mailing list