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 on 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.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.2.tar.gz
(5.1 kB
view hashes)
Built Distribution
zeam.utils.batch-0.2-py2.4.egg
(13.8 kB
view hashes)