[ZPT] Fiddly repeat

Charlie Clark charlie at begeistert.org
Wed Sep 24 08:39:07 EDT 2003


On 2003-09-24 at 14:32:03 [+0200], Charlie Clark wrote:
> 
> On 2003-09-24 at 13:57:04 [+0200], Charlie Clark wrote:
> > > return [[x.value for x in results[lstart:lstart+columns]] for lstart 
> > > in range(0,len(results),columns)]
> 
> mm, would work with a list object but not with a Zope results object 
> which can do slicing and thus raises an IndexError.

So to answer my own implied question: using results.dictionaries() to get 
this list.

My script is now

return [[x for x in results.dictionaries()[lstart:lstart+columns]] for 
lstart in range(0,len(results),columns)]

results and columns are passed in and only the objects are returned for 
greater flexibility.

Charlie



More information about the ZPT mailing list