[mod_python] cgi.FieldStorage() does not list POST, nor GET variables

Tom Van Acker tom at or-as.be
Wed Mar 11 13:09:55 EDT 2009


Dear All,

Recently, we moved an application to a server running Linux/SUSE, apache 
2.2.4, with mod_python 3.3.1.
In the attachment, I included the output from the testhandler (as described 
in http://www.modpython.org/live/current/doc-html/inst-trouble.html).

This application worked perfect before, but now, for some strange reason, 
nothing works anymore.
I spent a whole day investigating this problem, but now I'm stuck.
It seems like form variables are simply not passed to the python scripts. I 
tried using GET or POST  methods,
I tried the cgihandler and the publisher .... nothing helps.

I'm using cgi.FieldStorage() to get to the form variables, but the result is 
empty, no matter what I do.

This is how the apache configuration looks;

<Directory /srv/www/htdocs/>
  Options ExecCGI FollowSymLinks
  AllowOverride None
  Order allow,deny
  allow from all
  SetHandler mod_python
  PythonHandler mod_python.cgihandler
  PythonDebug On
</Directory>

A very simple python program I used for testing looks like this;

#!/usr/bin/python

import cgi

form = cgi.FieldStorage()

str=('%d ' % (len(form.keys())))
for name in form.keys():
    str=str+"Input: " + name + " value: " + form[name].value + "<BR>"

str=str+"Finished!"

print "Content-Type: text/html\n\n"
print str

The ouput simply is "0 Finished".
I'm really stuck, I'm afraid. Any help is greatly appreciated.

Thanks in advance,
Tom 



More information about the Mod_python mailing list