> Try this:
>
> $def ifelse(predicate, consequence, alternative=""):
>     $if predicate: $:consequence\
>     $else: $:alternative\
>
> $ id = 'a'
> <li $:ifelse(id == 'a',  'class="selected"')>...</li>
>
> Even better add a utility function.
>
> def ifelse(predicate, consequence, alternative=""):
>     if predicate: return consequence
>     else: return alternative
>
> How about adding this to web.template builtins by default?

So simple and yet so brilliant. Thanks
I think is common enough to be by default in the web.template builtins.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to