[ZPT] Re: Add 'parity' to repeat?

Shane Hathaway shane at zope.com
Thu Aug 28 09:07:21 EDT 2003


On 08/28/2003 05:16 AM, Charlie Clark wrote:
> On 2003-08-27 at 18:35:21 [+0200], you wrote:
> 
>>Another usable idiom is indexing:
>>
>><table tal:define="classes python:('one', 'two', 'three')">
>>   <tr tal:define="i repeat/row/index"
>>       tal:attributes="class python:classes[i % 3]">
>>
>>At least in Plone, though, simple even/odd alternation is *everywhere*.
> 
> 
> But Zope isn't Plone. I've started looking at CMF and Plone for my current 
> project but they are not where I am thinking. I can't be the only one like 
> this. Twisting ZPT to suit Plone's needs reminds me of the comments I've 
> heard from people about twisting Python for Zope's needs: brings benefits 
> but not to all.

This isn't about the core of ZPT, it's about ZTUtils.Iterator.Iterator. 
  That class contains utilities for iteration.  Most people only use the 
"index" attribute, but Iterator also has several other utilities like 
even(), odd(), number(), letter(), Roman(), etc.  parity() is a natural fit.

Evan's sinister secret plot to spread Plone to every server, desktop, 
handheld device, and human implant will not be aided by parity().

Shane




More information about the ZPT mailing list