[mod_python] mod_python.publisher - path traversal fails

John Black JohnBlack at kashori.com
Thu Aug 25 14:57:34 EDT 2005

After much testing, I have determined that it has nothing to do 
with the path traversal of mod_python.publisher. That is working 
fine, as are paramter passing, etc.

I have nailed the problem down to a SQL statement. The strange 
thing is this. The table has 4 columns. If I select any 1 or 2 of 
those 4 columns, everything is fine. If, however, I select 3 or more, 
then I receive a 404 error. There is no exception, no error message. 
I surrounded it with a try: except: block and get nothing. 

When I run the same select statements directly from the python 
interpreter everything is fine. Also, on two other systems the entire
program works fine. However, they are using MySQLdb 1.20.

All of which leads me to wonder: is there an incompatibility between
MySQLdb 1.0.1 and mod_python 3.1.4? 

I had to use MySQLdb 1.0.1 because I am stuck with Python 2.2.3 
for now and MySQLdb 1.20 requires Python 2.3.4

  ----- Original Message ----- 
  From: John Black 
  To: John Black ; mod_python at modpython.org 
  Sent: Wednesday, August 24, 2005 10:23 PM
  Subject: Re: [mod_python] mod_python.publisher - path traversal fails

  Ok. Actually I was just trying to keep it simple. I 
  realize that mod_python.publisher has a different 
  way of handling calls than is used with def handler(req)
  By the way, I have this code working on two other systems at 
  home. The whole thing works perfectly. On my home system, 
  when I use mod_python.publisher it is with a call like 


  However, on the production server mentioned below, this 
  does not work either. I still get the 404 error.

    Sent: Wednesday, August 24, 2005 10:08 PM

    I am working on a python application on a Red Hat Linux server running
    Apache 2.0.48 with Python 2.2.3 and mod_python 3.1.4

    I must not have something configured correctly and it seems to me that 
    causes mod_python.publisher fails. If I do this:


    when I have configured:

    <Directory /home/webadmin/domain.com/html>
        AddHandler mod_python .py
        PythonHandler mytest
        PythonDebug On

    Then the default 'def handler(req):' works and prints "Hello World".

    But if I try to do this:


    when I have configured:

    <Directory /home/webadmin/domain.com/html>
        AddHandler mod_python .py
        PythonHandler mod_python.publisher
        PythonDebug On

    Then I get a 404 error from Apache or a zero-byte return.

    However, if I call this http://domain.com/mytes.py (deforming mytest to mytes) 
    then I get this:
Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
    result = object(req)

  File "/usr/lib/python2.2/site-packages/mod_python/publisher.py", line 98, in handler

  File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 454, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named mytesCheers,
    John Black


    Mod_python mailing list
    Mod_python at modpython.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050825/63f03461/attachment.html

More information about the Mod_python mailing list