[Zope-dev] form variables and **kw

Florent Guillaume fg@nuxeo.com
Fri, 4 Oct 2002 12:49:46 +0000 (UTC)


Oliver Bleutgen  <myzope@gmx.net> wrote:
> def return_vars(self, var=None, **kw):
>    return "var: %s, kw: %s" % (var,kw)
> 
> 
> Is it correct that any passed form variable besides "var" will get lost, 
> i.e. that ZPublisher will _not_ marshall the other variables into the 
> method call?

Very often, to allow calling of some scripts from a form or from another
script, I end up using the idiom:

def somescripts(self, foo, bar, REQUEST=None, **kw)
# or:
##parameters=foo, bar, REQUEST=None, **kw

if REQUEST is not None:
    kw.update(REQUEST.form)

...


Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com