You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Graham Dumpleton (JIRA)" <ji...@apache.org> on 2007/04/05 13:48:32 UTC

[jira] Closed: (MODPYTHON-126) PythonHandler in directive sets req.hlist.directory to useless value.

     [ https://issues.apache.org/jira/browse/MODPYTHON-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Graham Dumpleton closed MODPYTHON-126.
--------------------------------------


> PythonHandler in <Files> directive sets req.hlist.directory to useless value.
> -----------------------------------------------------------------------------
>
>                 Key: MODPYTHON-126
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-126
>             Project: mod_python
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.7
>            Reporter: Graham Dumpleton
>         Assigned To: Graham Dumpleton
>             Fix For: 3.3
>
>
> When you have Apache ".htaccess" configuration like:
>   SetHandler mod_python
>   #PythonPath "['/Users/grahamd/Sites/auth']+sys.path"
>   <Files "page1.txt">
>   PythonHandler page1::handler_txt
>   </Files>
>   <Files "page2.txt">
>   PythonHandler page2::handler_txt
>   </Files>
> and "page1.txt" is accessed, the req.hlist.directory attribute, which is supposed to list the name of the directory the PythonHandler directive was used in, gets set to "page1.txt/" instead.
> This value then gets added into "sys.path". Because it doesn't actually identify the directory, the module "page1" cannot actually be found when the import is performed.
> [Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: Traceback (most recent call last):
> [Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt:   File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 288, in HandlerDispatch\n    log=debug)
> [Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt:   File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 508, in import_module\n    f, p, d = imp.find_module(parts[i], path)
> [Fri Feb 10 09:08:40 2006] [error] [client 127.0.0.1] PythonHandler page1::handler_txt: ImportError: No module named page1
> The only workaround at this point is to explicitly define the PythonPath directive to include the directory the modules and ".htaccess" file are in. Not sure yet whether there is a way in Apache of determining the directory the "Files" directive is used in and set "req.hlist.directory" correctly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.