Generic Batch support for Zope
Project description
zeam.utils.batch
This package provides a batch functionality for Zope 2 and Zope 3.
You can use it like that:
Your container which is going to handle the batch must implements the marker interface zeam.utils.batch.interfaces.IBatchedContent.
You create your batch object in your view code:
from zope.component import queryMultiAdapter from zeam.utils.batch import batch from zeam.utils.batch.interfaces import IBatchView class MyViewClass(...): def update(self): fulllist = ... self.myitems = batch(fulllist, count=10, name='myitems', request=self.request) self.batch = queryMultiAdapter((self.context, self.myitems, self.request), IBatchView)()
You use it in your template:
<tal:navigation tal:replace="structure view/batch" /> <tal:items tal:repeat="item view/myitems"> ... </tal:items> <tal:navigation tal:replace="structure view/batch" />
That’s it.
Changelog
0.3 (2008/10/28)
Fix and add tests,
Don’t display batch navigation if everything fits on one page,
No more special links are generated for the first page of the batch.
0.2
Initial release
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zeam.utils.batch-0.3.tar.gz
(8.3 kB
view hashes)
Built Distribution
zeam.utils.batch-0.3-py2.4.egg
(16.6 kB
view hashes)