[Zope] Question involving passing optional parameters to a zsql method

Tino Wildenhain tino at wildenhain.de
Tue Oct 19 12:51:27 EDT 2004


Am Di, den 19.10.2004 schrieb Jim Penny um 17:32:
> On Tue, 19 Oct 2004 10:19:50 -0500
> "Laura McCord" <Laura.McCord at doucet-austin.com> wrote:
...
> Suppose you have checkbox with name 'foo'.  In your DTML method, before
> your ZSQL call, do:
> 
> <dtml-call "REQUEST.set('foo', REQUEST.has_key('foo'))>
> 
> This will set the variable 'foo' to 0 if the checkbox name is not in the
> REQUEST (not checked), and 1 if the the checkbox name is in the request
> (checked).  This is exactly what you want.

Hm. I doubt that. This would actually set the variable to
True or False.

Solutions: REQUEST.get() can take a default value:

foo=REQUEST.get('foo',0)

which will return the actual value or 0

Also, ZSQL Methods DTML have default value
modifiers - check Zope-Book for details.

Of course it depends on what Laura is really doing here.

Regards
Tino



More information about the Zope mailing list