[Zope] Re: formatting the results of Zsql methods
Tino Wildenhain
tino at wildenhain.de
Mon Sep 27 02:55:59 EDT 2004
Hi,
Am So, den 26.09.2004 schrieb garry saddington um 20:13:
> > A PythonScript is your friend, here.
> >
> > ##Script (Python) "inRows"
> > ##title=Chunk a list into equal-length sub-lists
> > ##parameters=source, chunk_size=5
> > #
> > result = []
> > for start in range(0, len(source), chunk_size):
> > result.append(source[start:start+chunk_size])
> > return result
> >
> > Tres.
> Thanks, this works but then I would have to slice up the dictionaries to get
> at the individual values, so I have come up with this. Can anyone see a
> problem with it or could I do it more simply?
>
> <dtml-in getclasses>
> <dtml-if expr="_['sequence-number'] < 7">
> <input type="checkbox" name="allocation.classid:records" value="<dtml-var
> classid>">
> <dtml-var year><dtml-var teachgroup><dtml-var
> abbreviation>
...
> <dtml-elif expr="_['sequence-number'] ==31">
> <input type="checkbox" name="allocation.classid:records" value="<dtml-var
> classid>">
> <dtml-var year><dtml-var teachgroup><dtml-var abbreviation><br>
> </dtml-if>
> </dtml-in>
Hm. For me it looks much like a problem with your eyes ;)
Whats wrong with both the solutions we gave?
Why do you do it wrong with lots of dtml when there
are 2 examples that show it can be done within 3..4
lines? IF you _really_ want DTML here,
you have <dtml-in methodcall><tr><dtml-in sequence-item
mapping><td><dtml-var
whateverthenameofthecolumnis></td></dtml-in></tr></dtml-in>
More information about the Zope
mailing list