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 "Nicolas Lehuen (JIRA)" <ji...@apache.org> on 2005/08/10 14:53:35 UTC

[jira] Created: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

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


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.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

Posted by "Nicolas Lehuen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-72?page=all ]
     
Nicolas Lehuen resolved MODPYTHON-72:
-------------------------------------

    Fix Version: 3.2.0
     Resolution: Fixed
      Assign To:     (was: Nicolas Lehuen)

Integrated Graham's patch, ran the unit test suite, everything is OK. Graham, I need a confirmation for your particular test case, though.

> 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
>      Fix For: 3.2.0
>  Attachments: publisher.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-72?page=all ]
     
Graham Dumpleton closed MODPYTHON-72:
-------------------------------------


> 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.7
>     Reporter: Nicolas Lehuen
>      Fix For: 3.2.7
>  Attachments: publisher.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-72?page=all ]

Graham Dumpleton updated MODPYTHON-72:
--------------------------------------

    Attachment: publisher.txt

Jim, can you give this patch I have attached a go. What I have done is incorporated
the equivalent publisher code I had from Vampire where I already worked out fixes
for all the original publisher problems. This code also handles correctly the cases
for where the new publisher code has introduced problems as described above
and elsewhere. The code is well commented and I believe it is perhaps a bit easier
to follow anyway.

I haven't checked it against the test suite after having integrated it, just a few cases
covering the problematic areas where current problems are, so if you can run the
test suite other it, would be appreciated. We can then see where we go with this,
whether my alternative is going to be acceptable or whether it is going to be
necessary to try and make what was there work instead.



> 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
>  Attachments: publisher.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MODPYTHON-72?page=comments#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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

Posted by "Jim Gallacher (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MODPYTHON-72?page=comments#action_12320155 ] 

Jim Gallacher commented on MODPYTHON-72:
----------------------------------------

I can't reproduce this problem, or maybe I don't understand it properly. In the example, is # page.py a typo and should actually be page.html?

ie.

# page.html

       def index():
         return "<html></body><p>XXX</p></body></html>" 

works fine for me.

Likewise if I have a file stuff.html:

# stuff.html

def index(req):
    return "<html></body><p>MODPYTHON-72 stuff</p></body></html>" 

calling either "/stuff" or "/stuff.html" returns the correct page.

> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MODPYTHON-72?page=comments#action_12320249 ] 

Graham Dumpleton commented on MODPYTHON-72:
-------------------------------------------

Another bug in this new publisher code is that when SetHandler is used, in 3.1.3
it would only pay attention to files matched which had a ".py" extension. Actually
it would match anything returned by imp.get_suffixes(), but then it had some subtle
bugs in that as well, as described in MODPYTHON-22.

This all mean't that if you had "page.py" and "page.html" in a directory together and
you access "page.html" it would return not found. In the new publisher it attempts to
load the "page.html" file as Python code, which yields a syntax error like:

    File "/Users/grahamd/Sites/mp32/page.html", line 1

    
      ^

  SyntaxError: invalid syntax

> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (MODPYTHON-72) mod_python.publisher no longer pays attention to result of req.get_addhandler_exts()

Posted by "Nicolas Lehuen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-72?page=all ]

Nicolas Lehuen reassigned MODPYTHON-72:
---------------------------------------

    Assign To: Nicolas Lehuen

> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira