[Zope] Variable number of arguments

Holger Hoffmann hohoff@rz.uni-potsdam.de
Sun, 02 Dec 2001 22:44:08 +0100


Hi Jesper,

Jesper Holmberg wrote:
> 
> I'm having troubles passing a non-specified number of variables from a
> form to a method in one of my products.
> 
> The (simplified) method is like this:
> 
> def manage_editAction(self, *arguments, **keywords):
>     "Prints values"
>     print len(arguments)
>     for arg in arguments: print "arg:", arg
>     print len(keywords)
>     for kw in keywords.keys(): print kw, ':', keywords[kw]

do something like this:

def manage_editAction(self, REQUEST):
   "Prints values"
   for key in REQUEST.form.keys():
      print "%s: %s" % (key, REQUEST[key])


... Holger