[Zope-dev] Weird batches produced by dtml-in

Bjorn Stabell bjorn@exoweb.net
Wed, 12 Feb 2003 10:40:30 +0800


> From: Andreas Jung [mailto:lists@andreas-jung.com]=20
>=20
> Take a look at PloneBatch.py from the Plone package.=20
> PloneBatch.py is a very sophisticated module for batching and=20
> forget about dtml-in.
=20
That doesn't really solve my problem.  I don't use ZPT and I don't use
Plone, and the PloneBatch module doesn't strike me as a particularly
beautiful solution to the problem (mostly because of the extremely
verbose ZPT syntax, I guess).  In any case, my problem was with
dtml-in...

Unless someone says otherwise I'm assuming it's a bug in dtml-in and
will submit it to the collector in a day or so.


> --On Dienstag, 11. Februar 2003 17:01 +0800 Bjorn Stabell=20
> <bjorn@exoweb.net> wrote:
>=20
> > Hello,
> >
> > I'm trying to implement a Google-like pagination using the dtml-in=20
> > "batching system", and I'm getting some very strange=20
> results.  Either=20
> > I'm overlooking something obvious or there is a problem=20
> with dtml-in.=20
> > See attached source code of simplified example that produces the=20
> > strange results.
> >
> > The first time I access the page the results are as follows:
> >
> >     0-9 10-19 20-29 30-39 40-49 50-59 60-69 70-79
> >
> > If I click '10-19' it'll take me to batch_start=3D10, which gives =
the=20
> > following strange results:
> >
> >     0-8 10-19 19-28 29-38 39-48 49-58 59-68 69-78 79-79
> >
> > I have no idea why the first batch is now 0-8 and the next batch is=20
> > now 19-28.  Shouldn't they be 0-9 and 20-29 like above?
> >
> > I'm using Zope 2.6.1 precompiled Linux version.
> >
> >
> > -----------------------------
> >
> > <dtml-let
> >   batch=3D"_.range(100, 180)"
> >   batch_size=3D"10"
> >   batch_start=3D"REQUEST.get('batch_start', 0)">
> >
> > <dtml-in batch start=3D"batch_start" size=3D"batch_size" =
overlap=3D"0">
> >   &dtml-sequence-item;<br>
> > </dtml-in>
> >
> > <dtml-in batch start=3D"batch_start" size=3D"batch_size" previous=20
> > overlap=3D"0"> <dtml-in previous-batches mapping>
> >   <a href=3D"<dtml-var URL><dtml-var
> > sequence-query>batch_start=3D&dtml-batch-start-index;">
> >     &dtml-batch-start-index;-&dtml-batch-end-index;
> >   </a>
> > </dtml-in>
> > </dtml-in>
> >
> > <STRONG>&dtml-batch_start;-<dtml-var "batch_size +=20
> _.int(batch_start)=20
> > - 1"></STRONG>
> >
> > <dtml-in batch start=3D"batch_start" size=3D"batch_size" next=20
> overlap=3D"0">=20
> > <dtml-in next-batches mapping>
> >   <a href=3D"<dtml-var URL><dtml-var
> > sequence-query>batch_start=3D&dtml-batch-start-index;">
> >     &dtml-batch-start-index;-&dtml-batch-end-index;
> >   </a>
> > </dtml-in>
> > </dtml-in>
> >
> > </dtml-let>
> >
> > _______________________________________________
> > Zope-Dev maillist  -  Zope-Dev@zope.org=20
> > http://mail.zope.org/mailman/listinfo/zope-dev
> > **  No cross posts or HTML encoding!  **
> > (Related lists - =20
> http://mail.zope.org/mailman/listinfo/zope-announce
> > =20
> http://mail.zope.org/mailman/listinfo/zope )
>=20
>=20
>=20
>=20
>    =20
> ---------------------------------------------------------------------
>    -    Andreas Jung                    =20
> http://www.andreas-jung.com   -
>   -   EMail: andreas at=20
> andreas-jung.com                              -
>    -            "Life is too short to (re)write parsers"     =20
>          -
>    =20
> ---------------------------------------------------------------------
>=20
>=20
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
>=20