Jeff Sasmor writes:
> Is there a (straightforward?) way to dynamically compose function
> argument lists? For example, in C, you can write"
> f(arg1, arg2, (conditional expression)?(val for TRUE state):(val for FALSE state)).
Others have pointed out, that you can use
"and" and "or" to emulate "? ... : ...".
Be careful, there are dangers, because the emulation is not faithful.
> In my case here in Zope, sometimes I have to search a ZCatalog
> prior to displaying the results in a <dtml-in> looping construct.
> Now if the 'moderated' property is active I want to add the keyword arg
> to the arg list at the time that the searchResults method is invoked.
In some cases, you could use:
...(..., reviewed= moderated and 'on', ...)
This will define "reviewed". It will have a Python "false" value
if moderated is "false", otherwise the value 'on'.
If your function uses code like:
"if kw.has_key('reviewed') and kw['reviewed': ..."
this will work. If the second and term is missing, if won't.
I do not know, what code ZCatalog uses. Try it out or
look into the source.
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -