[Zope-dev] dtml-in batching improved
Ivo van der Wijk
ivo@amaze.nl
Mon, 18 Jun 2001 16:30:58 +0200
On Wed, Jun 13, 2001 at 04:28:12PM -0700, Jean Lagarde wrote:
> Good day all,
>
>
> Here is the original code, with my annotated change (I deleted an if test in
> two places):
>
> for index in range(first,end):
> # preset
> kw['previous-sequence']= 0
> kw['next-sequence']= 0 # now more often defined then
> previously
> #
> if index==first or index==last:
> # provide batching information
> if first > 0:
> pstart,pend,psize=opt(0,first+overlap,
> sz,orphan,sequence)
> deleted this test --> if index==first: kw['previous-sequence']=1
> kw['previous-sequence-start-index']=pstart-1
> kw['previous-sequence-end-index']=pend-1
> kw['previous-sequence-size']=pend+1-pstart
(more similar code removed)
This is basically my patch #1. It makes previous-sequence-* and
next-sequence-* available throughout the entire dtml-in loop.
This sounds like a good fix, but people may rely on these variables
being only set at resp. the start and end of the iteration.
So this patch may break existing dtml code.
That's why I suggested patch #2, which introduces new variables. Old
code will continue to work, but people who want the problem fixed can
use the newly introduced variables, which are available throughout the
iteration.
Ivo
--
Drs. I.R. van der Wijk -=-
Brouwersgracht 132 Amaze Internet Services V.O.F.
1013 HA Amsterdam -=-
Tel: +31-20-4688336 Linux/Web/Zope/SQL
Fax: +31-20-4688337 Network Solutions
Web: http://www.amaze.nl/ Consultancy
Email: ivo@amaze.nl -=-