Posted By

ches on 09/22/07


Tagged

python mako


Versions (?)

Alternate Table Row Classes in a Mako Template


 / Published in: Python
 

  1. % for i, elem in enumerate(elems): \n <tr class="${i%2 and 'odd' or 'even'}"> ...

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: wackysalut on February 16, 2008

% for i, elem in enumerate(elemts):

or

or

or

% endfor

Posted By: wackysalut on February 16, 2008

hrrmm.. ${['odd','even'][i%2]} or class="row${i%2}" or class="${[3,5,7][i%3]}

Posted By: realazy on April 15, 2008

with python 2.5, this must be more clear:

% for i, elem in enumerate(elems): % endfor

You need to login to post a comment.