[mod_python] publisher form values

Dave Britton dave at davebritton.com
Wed Jan 11 15:40:24 EST 2006

I am running modpython 2.7 on apache 1.3
I have an html form that is generated dynamically based on database entries,
so it may have an arbitrary number of fields displayed. In the module that
generates them they are numbered field1, field2, etc.
eg: (dynamically output html)

<form action = "handleform" method = "post">
Field1 <input type = "text" name = "field1"><br>
Field2 <input type = "text" name = "field2"><br>
Field3 <input type = "text" name = "field3"><br>
<input type = "submit"></form>

-- now, there might be 1 or 2 or x number of input fields, so I want to use
the **kwds parameter form for the processing function, eg:

def handleform(req, **kwds):

and I was hoping this would just work, and I would get a nifty and
arbitarily long set of variables name field1 - fieldn, but I couldn't seem
to make the syntax work. I reverted to just using this:

 for i in req.form.list:

to construct my own dictionary, but I am wondering if there is supposed to
be an easy way to do this in publisher and I am just too unfamiliar with
using **kwds to figure it out.
Thanks for any suggestions!

-Dave Britton

More information about the Mod_python mailing list