[mod_python] **kw syntax

sandor.kopanyi at mailbox.hu sandor.kopanyi at mailbox.hu
Thu Jun 20 10:10:18 EST 2002


Hi Gary,

> I want the <form>'s POST method deliver the (keyword,value) pairs from
the form
> to a python-based handler. My problem is this: I can't get get the **kw
> syntax to work with mod_python. That is, if my form looks like this 

[...]

> ... and my python function is defined as follows ...
> 
> def makechanges(request, **kw):
> 
> ... makechanges() receives kw={} regardless of the status of the
> checkboxes. If instead my function is defined as ... 

Define your function like this:
def makechanges(request):

The request object contains your fields, in request.form.list .
You can process them in a loop:
for f in request.form.list:
    #f.name is the name of the field
    #f.value holds the value of the field

(See more in modpythion docs, chapter 4.4)

Cheers,
Sandor


--------------------------------------------------
http://www.mailbox.hu - Mert levelezni kell...




More information about the Mod_python mailing list