Calling function with variable arguments from ZPublisher
(was: Re: [Zope-DB] Using psycopg directly in Zope Python script)
dieter at handshake.de
Mon Jul 4 13:10:59 EDT 2005
Jørgen Frøjk Kjærsgaard wrote at 2005-7-4 11:04 +0200:
>Another question: When I define an external method to process form data,
>I have to do it like this:
>def process_form_data(self, name, address, zip, ...):
>What I would like to do is:
>def process_form_data(self, **args):
>so that I don't have to alter the argument list if I add or remove
>fields. However, args always comes out empty, presumeably because Zope
>inspects the argument list and passes only those arguments that have a
>matching name in the list.
>Is there any way to tell Zope to pass "the
>rest" in **args?
No (unless you change "ZPublisher.mapply.mapply").
But, you can access all your request arguments via "REQUEST" (which you
can either pass explicitly or access via "self.REQUEST").
More information about the Zope-DB