Re: [Support] Re: Collector #2244: Zope, sequence-
From: "Chris Withers" <chrisw@nipltd.com>
Say I want to build something like this:
<<< Showing 4 to 10 of 400 >>>
Then you would probably find the Batch class from ZTUtils valuable. It's available from the same place as ZPT, which depends on it. It doesn't have all of the fancy features of dtml-in, but it is much simpler. You pass the sequence and batching parameters to the Batch constructor, and get an object that you can iterate over normally (using dtml-in or Python for:). Given Batch instance "b": <dtml-with b> <dtml-if previous><dtml-with previous> <a href="...?start=&dtml-start;"><<<</a> </dtml-with></dtml-if> Showing &dtml-start; to &dtml-end; of <dtml-var expr="_.len(seq)"> <dtml-if next><dtml-with next> <a href="...?start=&dtml-start;">>>></a> </dtml-with></dtml-if> </dtml-with> This code will work above, below, or inside of the <dtml-in b> loop. Cheers, Evan @ digicool
Evan Simpson wrote:
From: "Chris Withers" <chrisw@nipltd.com>
Say I want to build something like this:
<<< Showing 4 to 10 of 400 >>>
Then you would probably find the Batch class from ZTUtils valuable.
Is it documented anywhere? Can I import it into a PythonScript?
all of the fancy features of dtml-in, but it is much simpler. You pass the sequence and batching parameters to the Batch constructor, and get an object that you can iterate over normally (using dtml-in or Python for:). Given Batch instance "b":
Cool. :-) BUT, given that we've been told DTML isn't going away, this bug stands, IMHO... cheers, Chris
From: "Chris Withers" <chrisw@nipltd.com>
Then you would probably find the Batch class from ZTUtils valuable.
Is it documented anywhere? Can I import it into a PythonScript?
Documentation is minimal, as yet, but it's *very* simple. from ZTUtils import Batch b = Batch(seq, 25, start=context.REQUEST.get('start', 0)) (after installing it, of course) Cheers, Evan @ digicool
Evan Simpson wrote:
From: "Chris Withers" <chrisw@nipltd.com>
Then you would probably find the Batch class from ZTUtils valuable.
Is it documented anywhere? Can I import it into a PythonScript?
Documentation is minimal, as yet, but it's *very* simple.
from ZTUtils import Batch b = Batch(seq, 25, start=context.REQUEST.get('start', 0))
(after installing it, of course)
Cool :-) I assume it respects laziness? cheers, Chris PS: Any chance it could be moved to the core?
From: "Chris Withers" <chrisw@nipltd.com>
I assume it respects laziness?
It's very lazy, yes.
PS: Any chance it could be moved to the core?
A chance, but it will have to prove its worth, first. Cheers, Evan @ digicool
participants (2)
-
Chris Withers -
Evan Simpson