[mod_python] cgi handler

Philippe Schottey phillscot at mac.com
Wed Apr 11 05:06:24 EDT 2007


Hmm indeed, I was wrong...
On the hosting server the code seems to work fine.
On my machine (mac) however it does not work.
Maybe it is a configuration problem?

So I have:
python 2.4.3
apache 2.2.4.0
mod_python 3.3.1.0

The httpd config is:
#
# Additional files to server.
Alias /pschotte /Users/pschotte/Sites

#
# Activate python in the needed directories.
<Directory /Users/pschotte/Sites>
     # Give access.
     Order allow,deny
     Allow from all
     # Activate python.
     AddHandler mod_python .py
     PythonHandler mod_python.cgihandler
     PythonDebug On
</Directory>



On 09 Apr 2007, at 05:38, Graham Dumpleton wrote:

> Code works fine for me on mod_python 3.3.1, Python 2.3.5 and Apache  
> 2.2.1.
>
> Thus, nothing wrong with the code itself.
>
> Can you be more precise about which version of mod_python they are  
> using?
>
> On 09/04/07, Philippe Schottey <phillscot at mac.com> wrote:
>> Indeed, only the cgi_handler is configured.
>> Versions:
>> python 2.3
>> apache 2
>> mod_python 3.*
>>
>> The (test) script I have is:
>>
>> from mod_python import apache
>> import cgi
>>
>> form = cgi.FieldStorage()
>>
>> print """Content-type: text/html
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>>     <head>
>>         <title>test</title>
>>     </head>
>>     <body>
>>         """
>> print form.has_key('action')
>> print """
>>     </body>
>> </html>"""
>>
>>
>>
>> On 09 Apr 2007, at 03:52, Graham Dumpleton wrote:
>>
>> On 09/04/07, Philippe Schottey <phillscot at mac.com> wrote:
>> Hello,
>>
>> This is the first time i'm using python and mod_python.
>> The hosting company only wants to use the cgi_handler.
>>
>> Can you confirm that what you mean is that the web hosting company is
>> only allowing you to use as the handler for mod_python:
>>
>>  PythonHandler mod_python.cgihandler
>>
>> Just want to confirm so that we know for sure that you aren't just
>> using standard CGI.
>>
>>
>> I have some problems retrieving POST and GET parameters.
>> I've read somewhere that this should do the trick:
>>
>> import cgi
>> form = cgi.FieldStorage()
>> value = form[key]
>>
>> Can you perhaps show a more complete script?
>>
>> Also, which version of mod_python is being used and which version  
>> of Python?
>>
>> Graham
>>
>>
>> When I'm trying this, the form object is allways empty.
>> The form code:
>>  <form name="main" action="test.py" method="POST">
>>  <input type="hidden" name="action" id="action" value="good"/>
>>             <input type="submit"/>
>>  </form>
>>
>> I can't seem to retrieve the action parameter.
>>



More information about the Mod_python mailing list