[mod_python] FieldStorage's keep_blank_values argument andRequest.form

Graham Dumpleton grahamd at dscpl.com.au
Wed Oct 25 17:45:18 EDT 2006


Clodoaldo Pinto Neto wrote ..
> Since it is not possible to instantiate the FieldStorage class when
> using the Publisher handler is there a way to pass the
> keep_blank_values argument to Request.form?

Since publisher explicitly sets keep_blank_values to 1, does that mean
you want to override it to be 0?

Like mod_python.psp, the mod_python.publisher handler should perhaps
use an existing instance of the form stored as req.form. That way you
could wrap the publisher handler and override how the form is created.

  def handler(req):
    req.form = util.FieldStorage(req, keep_blank_values=0)
    return mod_python.publisher.handler(req)

This change should perhaps be made in mod_python 3,3.

By allowing this, it might feasibly allow things to be done with the file
callback hooks that FieldStorage accepts in the constructor as well.

Graham


More information about the Mod_python mailing list