[mod_python] Problem with mod_python and send data with a form

Graham Dumpleton grahamd at dscpl.com.au
Fri Aug 18 20:00:17 EDT 2006


On visual examination, I can't see anything specifically that looks  
wrong.

There is a potential conflict due to .py files being setup as both  
cgihandler
and publisher. I think that that in the Directory directive should take
precedence but I am not totally sure, as the Files one is at global  
scope
and may actually get merged with the other to create a scenario where
it might want to call both cgihandler and publisher in turn. If this  
were the
case it would fail as your file is not setup as a cgihandler.

If you can, see if you can get hold of any error messages from the  
Apache
error log related to your attempt to make the request. Can you also  
use a
command line program such as curl or wget to make a request against
the URL so you can see the actual error code that comes back and any
raw content in the response. You may be able to do this if you have  
certain
debug plugins for Firefox (don't know what they are called).

Finally, have you tried a straight GET request from your browser against
that URL, ie., don't use a POST form. Does it return anything in that  
situation.
Also, where is your export.php page. Based on action it would have to be
in root directory of site, is that the case?

Anyone else spot anything obvious I am missing?

Graham

On 19/08/2006, at 12:45 AM, David Bizier wrote:

> Hi,
>
> I'm a beginner with mod_python and Python (also with english langage,
> sorry). I tried some exemple code and all works fine!
>
> Unfortunately, I have a problem to send data with a form (POST ou  
> GET) to a
> .py script file. When I try to send data to my .py file, with  
> Firefox, I see
> a blank page, without text or error message.
>
> Here is my form (export.php):
>
> ------------------
> <html>
>    <body>
>   <FORM name="frm1" action="scripts/python/toto.py/say" method="POST">
>     <TABLE>
>       <TR>
>         <TD>First Name: </TD>
>         <TD><INPUT type="text" name="firstname" value="Bob"></TD>
>       </TR>
>       <TR>
>         <TD colspan="2" align="center"><INPUT type="submit"  
> value="Go"></TD>
>       </TR>
>     </TABLE>
>   </FORM>
>    </body>
> </html>
> --------------------
>
> And here is my python page (toto.py):
>
> -------------------
> from mod_python import apache
> from mod_python import util
>
> def say(req, firstname="NOTHING"):
>      req.content_type = "text/html"
>      return "I am saying %s" % firstname
> -------------------
>
> I have found a apache config file, on my server, with these lines:
>
>         "...
>         <IfModule mod_python.c>
>         <Files ~ (\.py$)>
>                 SetHandler python-program
>                 PythonHandler   mod_python.cgihandler
>         </Files>
>         </IfModule>
>
>         "...'
>
>         </Directory>
>
>         <Directory /var/www/vhosts/monSiteWeb.com/httpdocs/scripts/ 
> python>
>                 Options -Indexes FollowSymLinks MultiViews
>                 AllowOverride All
>                 AddHandler mod_python .py
>                 PythonHandler mod_python.publisher
>                 PythonDebug On
>         </Directory>
>
> Thanks for your help! I would like to find an answer shortly to  
> continue my
> project!
>
> Regards,
> David
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list