[mod_python] Directory containing PythonHandler directive.

Graham Dumpleton grahamd at dscpl.com.au
Sat Sep 11 15:15:38 EDT 2004


On 11/09/2004, at 12:36 AM, Gregory (Grisha) Trubetskoy wrote:

>
>
> On Fri, 10 Sep 2004, Graham Dumpleton wrote:
>
>> Is there any way that one can find out within a content handler at 
>> what directory
>> level the PythonHandler directive appeared for the request being 
>> processed?
>>
>> Ie., if PythonHandler is defined in:
>>
>>  /a/b/.htaccess
>>
>> and the request is for:
>>
>>  /a/b/c/d/e.html
>>
>
> It should be sys.path[0], unless you use PythonPath.

Between when I sent the email and saw this, I figured that sys.path may 
be my only
option. I'll need to do some experiments, but I wasn't sure though what 
happens
if for example /a/b/.htaccess defined PythonHandler but 
/a/b/c/.htaccess defines
some other mod_python handler besides the content handler. In this case 
sys.path
will possibly hold /a/b and /a/b/c. If sys.path is always reordered so 
that the
first entry is always the path for the handler being executed, all well 
and good,
if not, will be a bit more tricky.

Thanks though for confirming what I expected and I'll just have to play 
with it
a bit and look at what the code actually does.



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



More information about the Mod_python mailing list