[ZPT] Conditional attributes in TAL?

Jan Van Uytven wyvern at uvic.ca
Tue Mar 2 01:32:11 EST 2004


Thanks, that worked! So much nicer than repeating everything :)

On Mon, 2004-03-01 at 16:48, Ian Bicking wrote:
> On Mar 1, 2004, at 6:38 PM, Jan Van Uytven wrote:
> > This is my first posting to this list, so forgive me if for my newbie
> > questions.
> >
> > I have a ZSQL method that returns data for a TAL repeat tag. Now I want
> > to present the returned info in a table. I also want to apply a
> > different CSS style to a row depending on whether it's an even or odd
> > row. Sounds simple enough, but to my dismay there doesn't seem to be a
> > TAL method for adding an attribute to a tag depending on a given
> > condition. My hack is to do something like:
> 
> Try:
> 
> <tr tal:attributes="class python: test(repeat['pc'].even(), 'evenrow', 
> 'oddrow')">...
> 
> --
> Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
---
Jan (Wyvern) Van Uytven
Sysadmin, UVic TRIUMF
wyvern at uvic.ca

Randomly selected from my quote-file:

"Cry Havoc, and let slip the dogs of war!"
 *casts Grease under the war dogs*




More information about the ZPT mailing list