| Graham Dumpleton (JIRA) 2005-08-27, 7:46 am |
| [ http://issues.apache.org/jira/brows...action_12320248 ]
Graham Dumpleton commented on MODPYTHON-72:
-------------------------------------------
I definitely mean "page.py". I am definitely not suggesting that you have Python code
in an actual physical file called "page.html". I am suggesting you access it though as
"page.html". Accessing "page.html" should return HTML output. Accessing "page.py"
will return Python source code, although because it contains HTML it will not look
correct as markup will disappear.
Not sure why you can't duplicate it. On mod_python 3.1.3 it works for me with whether
or not MultiViews is enabled. On mod_python subversion head though, it doesn't work
at all and thus the basis of the bug report about it.
What happens is that since "page.html" doesn't map to an actual physical file, it gets
passed through in req.filename in total. Eg. dumping out req attributes at start of
publisher you should see:
[Sat Aug 27 19:53:26 2005] [error] req.uri='/~grahamd/mp32/page.html'
[Sat Aug 27 19:53:26 2005] [error] req.filename='/Users/grahamd/Sites/mp32/page.html'
[Sat Aug 27 19:53:26 2005] [error] req.path_info=''
It then fails the "if exists(req.filename)" check and in the "else" case it will check for
"isfile(req.filename+'.py')". Ie., checks for "page.html.py" which also wouldn't exist.
It therefore falls through to sticking "index.py" explicitly in req.filename and when
that doesn't exist raises Python error because of other problem I have highlighted.
The only way it would work is if "index.py" existed and in it it had something that
would resolve if "page.html" were mapped against it as "func_path". This would be
unlikely.
Anyway, I will work on a fix.
> mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()
> ------------------------------------------------------------------------------------
>
> Key: MODPYTHON-72
> URL: http://issues.apache.org/jira/browse/MODPYTHON-72
> Project: mod_python
> Type: Bug
> Versions: 3.2.0
> Reporter: Nicolas Lehuen
> Assignee: Nicolas Lehuen
>
> Says Graham :
> A final issue, is that latest mod_python.publisher no longer pays
> attention to result of req.get_addhandler_exts(). This means that where
> you used to be able to say:
> # .htaccess
> AddHandler mod_python .html
> PythonHandler mod_python.publisher
> # page.py
> def index():
> return "<html></body><p>XXX</p></body></html>"
> with URL of "/page.html", this no longer appears to work for me. In
> short it appears that one can only use ".py" as an extension or no
> extension at all. Defining another extension to AddHandler or
> PythonHandler seems to have no effect.
|