On 2月20日, 下午9时35分, Anand Chitipothu <[email protected]> wrote:
> > Well, apart from theoretical jQuery thing, which is not hard to deal
> > with in Templetor, except that it's a bit more typing, there's one
> > more thing that's a bit awkward. The if clause in tag attributes. For
> > example:
>
> > $if sunny:
> >    <div class="yellow">
> > $else:
> >    <div class="grey">
> > ...
> > </div>
>
> > would be nicer if it looked like:
>
> >    <div class="$('yellow' if sunny else 'grey')">...</div>
>
> I use this:
>
>  <div class="$cond(sunny, 'yellow', 'grey')">...</div>
>
> after adding web.cond to template globals.

This works even without adding web.cond to template globals:
 <div class="$(sunny and 'yellow' or 'grey')">...</div>

-- 
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