[Zope] conditionals inside dtml-let expressions
Mitchell L Model
mlm@acm.org
Thu, 18 Oct 2001 21:55:02 -0400
At 1:06 PM -0400 10/18/01, Jim Penny wrote:
>On Thu, Oct 18, 2001 at 12:56:02PM -0400, Mitchell Model wrote:
>> Is there a straightforward way to bind one of two values to a let
>> variable depending on the value of another variable? In C/C++/Java I
>> would use the ?: operator, but Python doesn't have that. Or should I
>> just bind the variable to None then set it later with something like
>>
>> <dtml-let var=None>
>> <dtml-if "testvar==targetval">
>> <dtml-var expr="_.set(var, 'yes')>
>> <dtml-else>
>> <dtml-var expr="_.set(var, 'no')>
>> </dtml-if>
>> </dtml-let>
>
>how about
>
><dtml-let var='no'>
> <dtml-if "testvar==targetval">
> <dtml-var expr="_.set(var, 'yes')>
> </dtml-if>
></dtml-let>
>
>Jim Penny
>
>(To be honest, I have never used dtml-let, so I may be way off base here)
Well, that's a little better than mine, anyway. Thanks.