Skip to main content

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:

  1. Your container which is going to handle the batch must implements the marker interface zeam.utils.batch.interfaces.IBatchedContent.

  2. 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)()
  3. 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)

Uploaded Source

Built Distribution

zeam.utils.batch-0.2-py2.4.egg (13.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page