plone.batching 3.0.0a2__tar.gz → 3.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/CHANGES.rst +30 -0
  2. {plone_batching-3.0.0a2/src/plone.batching.egg-info → plone_batching-3.0.2}/PKG-INFO +153 -132
  3. plone_batching-3.0.0a2/docs/usage.rst → plone_batching-3.0.2/README.rst +8 -1
  4. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/pyproject.toml +61 -1
  5. plone_batching-3.0.2/setup.py +4 -0
  6. {plone_batching-3.0.0a2 → plone_batching-3.0.2/src/plone.batching.egg-info}/PKG-INFO +153 -132
  7. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone.batching.egg-info/SOURCES.txt +0 -3
  8. plone_batching-3.0.0a2/README.rst +0 -7
  9. plone_batching-3.0.0a2/setup.py +0 -57
  10. plone_batching-3.0.0a2/src/plone.batching.egg-info/entry_points.txt +0 -2
  11. plone_batching-3.0.0a2/src/plone.batching.egg-info/not-zip-safe +0 -1
  12. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/CONTRIBUTING.rst +0 -0
  13. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/MANIFEST.in +0 -0
  14. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/docs/LICENSE.txt +0 -0
  15. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/docs/index.rst +0 -0
  16. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/setup.cfg +0 -0
  17. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/__init__.py +0 -0
  18. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/batch.py +0 -0
  19. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/batch_macros.pt +0 -0
  20. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/batching.rst +0 -0
  21. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/batchnavigation.pt +0 -0
  22. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/batchnavigation_bootstrap.pt +0 -0
  23. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/browser.py +0 -0
  24. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/configure.zcml +0 -0
  25. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/interfaces.py +0 -0
  26. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/tests/__init__.py +0 -0
  27. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/tests/test_batching.py +0 -0
  28. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone/batching/utils.py +0 -0
  29. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone.batching.egg-info/dependency_links.txt +0 -0
  30. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone.batching.egg-info/requires.txt +0 -0
  31. {plone_batching-3.0.0a2 → plone_batching-3.0.2}/src/plone.batching.egg-info/top_level.txt +0 -0
@@ -8,6 +8,36 @@ Changelog
8
8
 
9
9
  .. towncrier release notes start
10
10
 
11
+ 3.0.2 (2026-11-03)
12
+ ------------------
13
+
14
+ Internal:
15
+
16
+
17
+ - Update configuration files.
18
+ [plone devs]
19
+
20
+
21
+ 3.0.1 (2026-08-21)
22
+ ------------------
23
+
24
+ Internal:
25
+
26
+
27
+ - Move package metadata from ``setup.py`` to ``pyproject.toml``.
28
+ [plone devs]
29
+
30
+
31
+ 3.0.0 (2026-05-07)
32
+ ------------------
33
+
34
+ Internal:
35
+
36
+
37
+ - Update configuration files.
38
+ [plone devs]
39
+
40
+
11
41
  3.0.0a2 (2026-03-16)
12
42
  --------------------
13
43
 
@@ -1,11 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plone.batching
3
- Version: 3.0.0a2
3
+ Version: 3.0.2
4
4
  Summary: Batching facilities used in Plone
5
- Home-page: https://pypi.org/project/plone.batching
6
- Author: Plone Foundation
7
- Author-email: plone-developers@lists.sourceforge.net
8
- License: GPL
5
+ Author-email: Plone Foundation <plone-developers@lists.sourceforge.net>
6
+ Maintainer-email: Plone Foundation and contributors <plone-developers@lists.sourceforge.net>
7
+ License-Expression: GPL-2.0-only
8
+ Project-URL: Source, https://github.com/plone/plone.batching
9
+ Project-URL: Issues, https://github.com/plone/Products.CMFPlone/issues
10
+ Project-URL: Changelog, https://github.com/plone/plone.batching/blob/master/CHANGES.rst
9
11
  Keywords: Plone
10
12
  Classifier: Development Status :: 5 - Production/Stable
11
13
  Classifier: Environment :: Web Environment
@@ -13,11 +15,13 @@ Classifier: Framework :: Plone
13
15
  Classifier: Framework :: Plone :: 6.2
14
16
  Classifier: Framework :: Plone :: Core
15
17
  Classifier: Framework :: Zope :: 5
16
- Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
17
18
  Classifier: Operating System :: OS Independent
18
19
  Classifier: Programming Language :: Python
19
20
  Classifier: Programming Language :: Python :: 3.10
20
21
  Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
21
25
  Requires-Python: >=3.10
22
26
  Description-Content-Type: text/x-rst
23
27
  Requires-Dist: AccessControl
@@ -27,18 +31,6 @@ Requires-Dist: zope.schema
27
31
  Provides-Extra: test
28
32
  Requires-Dist: zope.component; extra == "test"
29
33
  Requires-Dist: zope.publisher; extra == "test"
30
- Dynamic: author
31
- Dynamic: author-email
32
- Dynamic: classifier
33
- Dynamic: description
34
- Dynamic: description-content-type
35
- Dynamic: home-page
36
- Dynamic: keywords
37
- Dynamic: license
38
- Dynamic: provides-extra
39
- Dynamic: requires-dist
40
- Dynamic: requires-python
41
- Dynamic: summary
42
34
 
43
35
  Welcome to Plone batching's documentation!
44
36
  ==========================================
@@ -48,6 +40,119 @@ This package includes facilities for creating a batched sequence.
48
40
  It originated from the the PloneBatch module written for Plone which in
49
41
  itself has been based on Zope2's ZTUtils.Batch.
50
42
 
43
+ Usage
44
+ =====
45
+
46
+ A batch defined in plone.batching usually consists of two things:
47
+
48
+ 1. A batch object.
49
+ This is usually a wrapper for a sequence, which provides slices of information.
50
+
51
+ #. A batch view.
52
+ This is needed for display.
53
+ It contains links to navigate to the slices defined in 1.
54
+
55
+ Both elements can be defined and accessed in Python code AND pagetemplates.
56
+
57
+ Batch navigation in templates
58
+ -----------------------------
59
+
60
+ For the use of batching features in Page Templates *plone.batching* the first thing you have to do is to create a sequence batch and put it in a template variable named *batch*.
61
+ You should do this in a view class if possible::
62
+
63
+ <div tal:define="batch view/batchresults;">
64
+
65
+ or you can do it in the template itself if necessary::
66
+
67
+ <div tal:define="Batch python:modules['plone.batching'].Batch;
68
+ b_size python:30;b_start python:0;b_start request/b_start | b_start;
69
+ batch python:Batch(results, b_size, int(b_start), orphan=1);">
70
+
71
+ For the navigation you add the following snippet to your template::
72
+
73
+ <tal:batchnavigation
74
+ define="batchnavigation nocall:context/@@batchnavigation"
75
+ replace="structure python:batchnavigation(batch)" />
76
+
77
+ For backwards compatibility *plone.batching* provides a drop in metal macro *navigation* in the *batch_macros* template.
78
+ Add it to the template like this::
79
+
80
+ <div metal:use-macro="context/batch_macros/macros/navigation" />
81
+
82
+
83
+ Usage in Python code
84
+ --------------------
85
+
86
+ A batch is instantiated like this::
87
+
88
+ >>> from plone.batching import Batch
89
+ >>> batch = Batch(range(100), size=15, orphan=10)
90
+
91
+ This generates 5 subbatches with 15 items from the sequence [0, 1, ..., 99] and one subbatch with the last 25 items (including 10 orphaned items).
92
+ For a detailed description of available parameters for a batch look at the API of the BaseBatch class.
93
+
94
+ Another way to instaniate a batch is like this::
95
+
96
+ >>> batch = Batch.fromPagenumber(range(100), pagesize=15, pagenumber=1)
97
+
98
+ This results in 6 batches with 15 items and one batch with the last 10 items.
99
+ This way of creating a batch is meant as a short cut and does not support all the options the canonical constructor supports.
100
+
101
+ For big sequences there is another base class provided by the package: *QuantumBatch*.
102
+ This batch generates quantum leaps for quicker navigation.
103
+
104
+ ::
105
+
106
+ >>> from plone.batching.batch import QuantumBatch
107
+ >>> qb = QuantumBatch(range(1000), 10, start=500, quantumleap=1)
108
+ >>> qb.leapforward
109
+ [69, 84]
110
+ >>> qb.leapback
111
+ [18, 33]
112
+
113
+ It is possible to navigate the batch stored in the two attributes *leapback* and *leapforward* with 5 clicks.
114
+
115
+ Usage in Views
116
+ --------------
117
+
118
+ Plone.batching comes with a customizable batch View *batchnavigation* with the view class *BatchView*.
119
+ The view comes with a template.
120
+ All you have to do, if you want to customize it, is to override the make_link-method.
121
+ This method should return a string with the link to the given *pagenumber*.
122
+ Here is an example from the folder_contents implementation in plone.app.content::
123
+
124
+ >>> from plone.batching.browser import BatchView
125
+ >>> from ZTUtils import make_query
126
+
127
+ >>> class MyBatchView(BatchView):
128
+ ... def make_link(self, pagenumber):
129
+ ... batchlinkparams = self.request.form.copy()
130
+ ... return '%s?%s' % (self.request.ACTUAL_URL,
131
+ ... make_query(batchlinkparams, {'pagenumber': pagenumber}))
132
+
133
+ One thing you have to keep in mind is to call the batch view with a batch as the first argument.
134
+
135
+ ::
136
+
137
+ >>> from Products.Five import BrowserView
138
+ >>> class MyContentView(BrowserView):
139
+ ... def batch(self):
140
+ ... " " # see above how a batch is defined
141
+ ...
142
+ ... def batching(self):
143
+ ... return MyBatchView(self.context, self.request)(self.batch)
144
+
145
+ Now you can use this in the template of your view.
146
+
147
+ ::
148
+
149
+ <div tal:replace="structure view/batching" />
150
+
151
+ Incompatibilities
152
+ -----------------
153
+
154
+ XXX __len__ method
155
+
51
156
  Changelog
52
157
  =========
53
158
 
@@ -58,6 +163,36 @@ Changelog
58
163
 
59
164
  .. towncrier release notes start
60
165
 
166
+ 3.0.2 (2026-11-03)
167
+ ------------------
168
+
169
+ Internal:
170
+
171
+
172
+ - Update configuration files.
173
+ [plone devs]
174
+
175
+
176
+ 3.0.1 (2026-08-21)
177
+ ------------------
178
+
179
+ Internal:
180
+
181
+
182
+ - Move package metadata from ``setup.py`` to ``pyproject.toml``.
183
+ [plone devs]
184
+
185
+
186
+ 3.0.0 (2026-05-07)
187
+ ------------------
188
+
189
+ Internal:
190
+
191
+
192
+ - Update configuration files.
193
+ [plone devs]
194
+
195
+
61
196
  3.0.0a2 (2026-03-16)
62
197
  --------------------
63
198
 
@@ -362,117 +497,3 @@ Fixes:
362
497
 
363
498
  - Factored out Plone batching implementation to separate egg (PLIP #12235)
364
499
  [tom_gross]
365
-
366
- Usage
367
- =====
368
-
369
- A batch defined in plone.batching usually consists of two things:
370
-
371
- 1. A batch object.
372
- This is usually a wrapper for a sequence, which provides slices of information.
373
-
374
- #. A batch view.
375
- This is needed for display.
376
- It contains links to navigate to the slices defined in 1.
377
-
378
- Both elements can be defined and accessed in Python code AND pagetemplates.
379
-
380
- Batch navigation in templates
381
- -----------------------------
382
-
383
- For the use of batching features in Page Templates *plone.batching* the first thing you have to do is to create a sequence batch and put it in a template variable named *batch*.
384
- You should do this in a view class if possible::
385
-
386
- <div tal:define="batch view/batchresults;">
387
-
388
- or you can do it in the template itself if necessary::
389
-
390
- <div tal:define="Batch python:modules['plone.batching'].Batch;
391
- b_size python:30;b_start python:0;b_start request/b_start | b_start;
392
- batch python:Batch(results, b_size, int(b_start), orphan=1);">
393
-
394
- For the navigation you add the following snippet to your template::
395
-
396
- <tal:batchnavigation
397
- define="batchnavigation nocall:context/@@batchnavigation"
398
- replace="structure python:batchnavigation(batch)" />
399
-
400
- For backwards compatibility *plone.batching* provides a drop in metal macro *navigation* in the *batch_macros* template.
401
- Add it to the template like this::
402
-
403
- <div metal:use-macro="context/batch_macros/macros/navigation" />
404
-
405
-
406
- Usage in Python code
407
- --------------------
408
-
409
- A batch is instantiated like this::
410
-
411
- >>> from plone.batching import Batch
412
- >>> batch = Batch(range(100), size=15, orphan=10)
413
-
414
- This generates 5 subbatches with 15 items from the sequence [0, 1, ..., 99] and one subbatch with the last 25 items (including 10 orphaned items).
415
- For a detailed description of available parameters for a batch look at the API of the BaseBatch class.
416
-
417
- Another way to instaniate a batch is like this::
418
-
419
- >>> batch = Batch.fromPagenumber(range(100), pagesize=15, pagenumber=1)
420
-
421
- This results in 6 batches with 15 items and one batch with the last 10 items.
422
- This way of creating a batch is meant as a short cut and does not support all the options the canonical constructor supports.
423
-
424
- For big sequences there is another base class provided by the package: *QuantumBatch*.
425
- This batch generates quantum leaps for quicker navigation.
426
-
427
- ::
428
-
429
- >>> from plone.batching.batch import QuantumBatch
430
- >>> qb = QuantumBatch(range(1000), 10, start=500, quantumleap=1)
431
- >>> qb.leapforward
432
- [69, 84]
433
- >>> qb.leapback
434
- [18, 33]
435
-
436
- It is possible to navigate the batch stored in the two attributes *leapback* and *leapforward* with 5 clicks.
437
-
438
- Usage in Views
439
- --------------
440
-
441
- Plone.batching comes with a customizable batch View *batchnavigation* with the view class *BatchView*.
442
- The view comes with a template.
443
- All you have to do, if you want to customize it, is to override the make_link-method.
444
- This method should return a string with the link to the given *pagenumber*.
445
- Here is an example from the folder_contents implementation in plone.app.content::
446
-
447
- >>> from plone.batching.browser import BatchView
448
- >>> from ZTUtils import make_query
449
-
450
- >>> class MyBatchView(BatchView):
451
- ... def make_link(self, pagenumber):
452
- ... batchlinkparams = self.request.form.copy()
453
- ... return '%s?%s' % (self.request.ACTUAL_URL,
454
- ... make_query(batchlinkparams, {'pagenumber': pagenumber}))
455
-
456
- One thing you have to keep in mind is to call the batch view with a batch as the first argument.
457
-
458
- ::
459
-
460
- >>> from Products.Five import BrowserView
461
- >>> class MyContentView(BrowserView):
462
- ... def batch(self):
463
- ... " " # see above how a batch is defined
464
- ...
465
- ... def batching(self):
466
- ... return MyBatchView(self.context, self.request)(self.batch)
467
-
468
- Now you can use this in the template of your view.
469
-
470
- ::
471
-
472
- <div tal:replace="structure view/batching" />
473
-
474
- Incompatibilities
475
- -----------------
476
-
477
- XXX __len__ method
478
-
@@ -1,3 +1,11 @@
1
+ Welcome to Plone batching's documentation!
2
+ ==========================================
3
+
4
+ This package includes facilities for creating a batched sequence.
5
+
6
+ It originated from the the PloneBatch module written for Plone which in
7
+ itself has been based on Zope2's ZTUtils.Batch.
8
+
1
9
  Usage
2
10
  =====
3
11
 
@@ -110,4 +118,3 @@ Incompatibilities
110
118
  -----------------
111
119
 
112
120
  XXX __len__ method
113
-
@@ -1,9 +1,64 @@
1
1
  # Generated from:
2
- # https://github.com/plone/meta/tree/main/src/plone/meta/default
2
+ # https://github.com/plone/meta/tree/2.x/src/plone/meta/default
3
3
  # See the inline comments on how to expand/tweak this configuration file
4
4
  [build-system]
5
5
  requires = ["setuptools>=68.2,<83", "wheel"]
6
6
 
7
+ # START-MARKER-MANUAL-CONFIG
8
+ # Anything from here until END-MARKER-MANUAL-CONFIG
9
+ # will be kept by plone.meta
10
+
11
+ [project]
12
+ name = "plone.batching"
13
+ version = "3.0.2"
14
+ description = "Batching facilities used in Plone"
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Environment :: Web Environment",
18
+ "Framework :: Plone",
19
+ "Framework :: Plone :: 6.2",
20
+ "Framework :: Plone :: Core",
21
+ "Framework :: Zope :: 5",
22
+ "Operating System :: OS Independent",
23
+ "Programming Language :: Python",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ ]
30
+ license = "GPL-2.0-only"
31
+ dynamic = ["readme"]
32
+ requires-python = ">=3.10"
33
+ authors = [
34
+ {name = "Plone Foundation",email = "plone-developers@lists.sourceforge.net"},
35
+ ]
36
+ maintainers = [
37
+ {name = "Plone Foundation and contributors",email = "plone-developers@lists.sourceforge.net"},
38
+ ]
39
+ dependencies = [
40
+ "AccessControl",
41
+ "Zope",
42
+ "zope.interface",
43
+ "zope.schema",
44
+ ]
45
+ keywords = ["Plone"]
46
+
47
+ [project.optional-dependencies]
48
+ test = [
49
+ "zope.component",
50
+ "zope.publisher",
51
+ ]
52
+
53
+ [project.urls]
54
+ Source = "https://github.com/plone/plone.batching"
55
+ Issues = "https://github.com/plone/Products.CMFPlone/issues"
56
+ Changelog = "https://github.com/plone/plone.batching/blob/master/CHANGES.rst"
57
+
58
+ [tool.setuptools.dynamic]
59
+ readme = {file = ["README.rst", "CHANGES.rst"]}
60
+ # END-MARKER-MANUAL-CONFIG
61
+
7
62
  [tool.towncrier]
8
63
  directory = "news/"
9
64
  filename = "CHANGES.rst"
@@ -129,6 +184,11 @@ pytest-plone = ['pytest', 'zope.pytestlayer', 'plone.testing', 'plone.app.testin
129
184
  # "gitpython = ['git']",
130
185
  # "pygithub = ['github']",
131
186
  # ]
187
+ #
188
+ # The Zope and Plone mappings above are included by default. For a package
189
+ # used outside the Zope world they are noise, and can be turned off with:
190
+ # [pyproject]
191
+ # plone_mappings = false
132
192
  ##
133
193
 
134
194
  [tool.check-manifest]
@@ -0,0 +1,4 @@
1
+ from setuptools import setup
2
+
3
+ # See pyproject.toml for package metadata
4
+ setup()
@@ -1,11 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plone.batching
3
- Version: 3.0.0a2
3
+ Version: 3.0.2
4
4
  Summary: Batching facilities used in Plone
5
- Home-page: https://pypi.org/project/plone.batching
6
- Author: Plone Foundation
7
- Author-email: plone-developers@lists.sourceforge.net
8
- License: GPL
5
+ Author-email: Plone Foundation <plone-developers@lists.sourceforge.net>
6
+ Maintainer-email: Plone Foundation and contributors <plone-developers@lists.sourceforge.net>
7
+ License-Expression: GPL-2.0-only
8
+ Project-URL: Source, https://github.com/plone/plone.batching
9
+ Project-URL: Issues, https://github.com/plone/Products.CMFPlone/issues
10
+ Project-URL: Changelog, https://github.com/plone/plone.batching/blob/master/CHANGES.rst
9
11
  Keywords: Plone
10
12
  Classifier: Development Status :: 5 - Production/Stable
11
13
  Classifier: Environment :: Web Environment
@@ -13,11 +15,13 @@ Classifier: Framework :: Plone
13
15
  Classifier: Framework :: Plone :: 6.2
14
16
  Classifier: Framework :: Plone :: Core
15
17
  Classifier: Framework :: Zope :: 5
16
- Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
17
18
  Classifier: Operating System :: OS Independent
18
19
  Classifier: Programming Language :: Python
19
20
  Classifier: Programming Language :: Python :: 3.10
20
21
  Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
21
25
  Requires-Python: >=3.10
22
26
  Description-Content-Type: text/x-rst
23
27
  Requires-Dist: AccessControl
@@ -27,18 +31,6 @@ Requires-Dist: zope.schema
27
31
  Provides-Extra: test
28
32
  Requires-Dist: zope.component; extra == "test"
29
33
  Requires-Dist: zope.publisher; extra == "test"
30
- Dynamic: author
31
- Dynamic: author-email
32
- Dynamic: classifier
33
- Dynamic: description
34
- Dynamic: description-content-type
35
- Dynamic: home-page
36
- Dynamic: keywords
37
- Dynamic: license
38
- Dynamic: provides-extra
39
- Dynamic: requires-dist
40
- Dynamic: requires-python
41
- Dynamic: summary
42
34
 
43
35
  Welcome to Plone batching's documentation!
44
36
  ==========================================
@@ -48,6 +40,119 @@ This package includes facilities for creating a batched sequence.
48
40
  It originated from the the PloneBatch module written for Plone which in
49
41
  itself has been based on Zope2's ZTUtils.Batch.
50
42
 
43
+ Usage
44
+ =====
45
+
46
+ A batch defined in plone.batching usually consists of two things:
47
+
48
+ 1. A batch object.
49
+ This is usually a wrapper for a sequence, which provides slices of information.
50
+
51
+ #. A batch view.
52
+ This is needed for display.
53
+ It contains links to navigate to the slices defined in 1.
54
+
55
+ Both elements can be defined and accessed in Python code AND pagetemplates.
56
+
57
+ Batch navigation in templates
58
+ -----------------------------
59
+
60
+ For the use of batching features in Page Templates *plone.batching* the first thing you have to do is to create a sequence batch and put it in a template variable named *batch*.
61
+ You should do this in a view class if possible::
62
+
63
+ <div tal:define="batch view/batchresults;">
64
+
65
+ or you can do it in the template itself if necessary::
66
+
67
+ <div tal:define="Batch python:modules['plone.batching'].Batch;
68
+ b_size python:30;b_start python:0;b_start request/b_start | b_start;
69
+ batch python:Batch(results, b_size, int(b_start), orphan=1);">
70
+
71
+ For the navigation you add the following snippet to your template::
72
+
73
+ <tal:batchnavigation
74
+ define="batchnavigation nocall:context/@@batchnavigation"
75
+ replace="structure python:batchnavigation(batch)" />
76
+
77
+ For backwards compatibility *plone.batching* provides a drop in metal macro *navigation* in the *batch_macros* template.
78
+ Add it to the template like this::
79
+
80
+ <div metal:use-macro="context/batch_macros/macros/navigation" />
81
+
82
+
83
+ Usage in Python code
84
+ --------------------
85
+
86
+ A batch is instantiated like this::
87
+
88
+ >>> from plone.batching import Batch
89
+ >>> batch = Batch(range(100), size=15, orphan=10)
90
+
91
+ This generates 5 subbatches with 15 items from the sequence [0, 1, ..., 99] and one subbatch with the last 25 items (including 10 orphaned items).
92
+ For a detailed description of available parameters for a batch look at the API of the BaseBatch class.
93
+
94
+ Another way to instaniate a batch is like this::
95
+
96
+ >>> batch = Batch.fromPagenumber(range(100), pagesize=15, pagenumber=1)
97
+
98
+ This results in 6 batches with 15 items and one batch with the last 10 items.
99
+ This way of creating a batch is meant as a short cut and does not support all the options the canonical constructor supports.
100
+
101
+ For big sequences there is another base class provided by the package: *QuantumBatch*.
102
+ This batch generates quantum leaps for quicker navigation.
103
+
104
+ ::
105
+
106
+ >>> from plone.batching.batch import QuantumBatch
107
+ >>> qb = QuantumBatch(range(1000), 10, start=500, quantumleap=1)
108
+ >>> qb.leapforward
109
+ [69, 84]
110
+ >>> qb.leapback
111
+ [18, 33]
112
+
113
+ It is possible to navigate the batch stored in the two attributes *leapback* and *leapforward* with 5 clicks.
114
+
115
+ Usage in Views
116
+ --------------
117
+
118
+ Plone.batching comes with a customizable batch View *batchnavigation* with the view class *BatchView*.
119
+ The view comes with a template.
120
+ All you have to do, if you want to customize it, is to override the make_link-method.
121
+ This method should return a string with the link to the given *pagenumber*.
122
+ Here is an example from the folder_contents implementation in plone.app.content::
123
+
124
+ >>> from plone.batching.browser import BatchView
125
+ >>> from ZTUtils import make_query
126
+
127
+ >>> class MyBatchView(BatchView):
128
+ ... def make_link(self, pagenumber):
129
+ ... batchlinkparams = self.request.form.copy()
130
+ ... return '%s?%s' % (self.request.ACTUAL_URL,
131
+ ... make_query(batchlinkparams, {'pagenumber': pagenumber}))
132
+
133
+ One thing you have to keep in mind is to call the batch view with a batch as the first argument.
134
+
135
+ ::
136
+
137
+ >>> from Products.Five import BrowserView
138
+ >>> class MyContentView(BrowserView):
139
+ ... def batch(self):
140
+ ... " " # see above how a batch is defined
141
+ ...
142
+ ... def batching(self):
143
+ ... return MyBatchView(self.context, self.request)(self.batch)
144
+
145
+ Now you can use this in the template of your view.
146
+
147
+ ::
148
+
149
+ <div tal:replace="structure view/batching" />
150
+
151
+ Incompatibilities
152
+ -----------------
153
+
154
+ XXX __len__ method
155
+
51
156
  Changelog
52
157
  =========
53
158
 
@@ -58,6 +163,36 @@ Changelog
58
163
 
59
164
  .. towncrier release notes start
60
165
 
166
+ 3.0.2 (2026-11-03)
167
+ ------------------
168
+
169
+ Internal:
170
+
171
+
172
+ - Update configuration files.
173
+ [plone devs]
174
+
175
+
176
+ 3.0.1 (2026-08-21)
177
+ ------------------
178
+
179
+ Internal:
180
+
181
+
182
+ - Move package metadata from ``setup.py`` to ``pyproject.toml``.
183
+ [plone devs]
184
+
185
+
186
+ 3.0.0 (2026-05-07)
187
+ ------------------
188
+
189
+ Internal:
190
+
191
+
192
+ - Update configuration files.
193
+ [plone devs]
194
+
195
+
61
196
  3.0.0a2 (2026-03-16)
62
197
  --------------------
63
198
 
@@ -362,117 +497,3 @@ Fixes:
362
497
 
363
498
  - Factored out Plone batching implementation to separate egg (PLIP #12235)
364
499
  [tom_gross]
365
-
366
- Usage
367
- =====
368
-
369
- A batch defined in plone.batching usually consists of two things:
370
-
371
- 1. A batch object.
372
- This is usually a wrapper for a sequence, which provides slices of information.
373
-
374
- #. A batch view.
375
- This is needed for display.
376
- It contains links to navigate to the slices defined in 1.
377
-
378
- Both elements can be defined and accessed in Python code AND pagetemplates.
379
-
380
- Batch navigation in templates
381
- -----------------------------
382
-
383
- For the use of batching features in Page Templates *plone.batching* the first thing you have to do is to create a sequence batch and put it in a template variable named *batch*.
384
- You should do this in a view class if possible::
385
-
386
- <div tal:define="batch view/batchresults;">
387
-
388
- or you can do it in the template itself if necessary::
389
-
390
- <div tal:define="Batch python:modules['plone.batching'].Batch;
391
- b_size python:30;b_start python:0;b_start request/b_start | b_start;
392
- batch python:Batch(results, b_size, int(b_start), orphan=1);">
393
-
394
- For the navigation you add the following snippet to your template::
395
-
396
- <tal:batchnavigation
397
- define="batchnavigation nocall:context/@@batchnavigation"
398
- replace="structure python:batchnavigation(batch)" />
399
-
400
- For backwards compatibility *plone.batching* provides a drop in metal macro *navigation* in the *batch_macros* template.
401
- Add it to the template like this::
402
-
403
- <div metal:use-macro="context/batch_macros/macros/navigation" />
404
-
405
-
406
- Usage in Python code
407
- --------------------
408
-
409
- A batch is instantiated like this::
410
-
411
- >>> from plone.batching import Batch
412
- >>> batch = Batch(range(100), size=15, orphan=10)
413
-
414
- This generates 5 subbatches with 15 items from the sequence [0, 1, ..., 99] and one subbatch with the last 25 items (including 10 orphaned items).
415
- For a detailed description of available parameters for a batch look at the API of the BaseBatch class.
416
-
417
- Another way to instaniate a batch is like this::
418
-
419
- >>> batch = Batch.fromPagenumber(range(100), pagesize=15, pagenumber=1)
420
-
421
- This results in 6 batches with 15 items and one batch with the last 10 items.
422
- This way of creating a batch is meant as a short cut and does not support all the options the canonical constructor supports.
423
-
424
- For big sequences there is another base class provided by the package: *QuantumBatch*.
425
- This batch generates quantum leaps for quicker navigation.
426
-
427
- ::
428
-
429
- >>> from plone.batching.batch import QuantumBatch
430
- >>> qb = QuantumBatch(range(1000), 10, start=500, quantumleap=1)
431
- >>> qb.leapforward
432
- [69, 84]
433
- >>> qb.leapback
434
- [18, 33]
435
-
436
- It is possible to navigate the batch stored in the two attributes *leapback* and *leapforward* with 5 clicks.
437
-
438
- Usage in Views
439
- --------------
440
-
441
- Plone.batching comes with a customizable batch View *batchnavigation* with the view class *BatchView*.
442
- The view comes with a template.
443
- All you have to do, if you want to customize it, is to override the make_link-method.
444
- This method should return a string with the link to the given *pagenumber*.
445
- Here is an example from the folder_contents implementation in plone.app.content::
446
-
447
- >>> from plone.batching.browser import BatchView
448
- >>> from ZTUtils import make_query
449
-
450
- >>> class MyBatchView(BatchView):
451
- ... def make_link(self, pagenumber):
452
- ... batchlinkparams = self.request.form.copy()
453
- ... return '%s?%s' % (self.request.ACTUAL_URL,
454
- ... make_query(batchlinkparams, {'pagenumber': pagenumber}))
455
-
456
- One thing you have to keep in mind is to call the batch view with a batch as the first argument.
457
-
458
- ::
459
-
460
- >>> from Products.Five import BrowserView
461
- >>> class MyContentView(BrowserView):
462
- ... def batch(self):
463
- ... " " # see above how a batch is defined
464
- ...
465
- ... def batching(self):
466
- ... return MyBatchView(self.context, self.request)(self.batch)
467
-
468
- Now you can use this in the template of your view.
469
-
470
- ::
471
-
472
- <div tal:replace="structure view/batching" />
473
-
474
- Incompatibilities
475
- -----------------
476
-
477
- XXX __len__ method
478
-
@@ -6,12 +6,9 @@ pyproject.toml
6
6
  setup.py
7
7
  docs/LICENSE.txt
8
8
  docs/index.rst
9
- docs/usage.rst
10
9
  src/plone.batching.egg-info/PKG-INFO
11
10
  src/plone.batching.egg-info/SOURCES.txt
12
11
  src/plone.batching.egg-info/dependency_links.txt
13
- src/plone.batching.egg-info/entry_points.txt
14
- src/plone.batching.egg-info/not-zip-safe
15
12
  src/plone.batching.egg-info/requires.txt
16
13
  src/plone.batching.egg-info/top_level.txt
17
14
  src/plone/batching/__init__.py
@@ -1,7 +0,0 @@
1
- Welcome to Plone batching's documentation!
2
- ==========================================
3
-
4
- This package includes facilities for creating a batched sequence.
5
-
6
- It originated from the the PloneBatch module written for Plone which in
7
- itself has been based on Zope2's ZTUtils.Batch.
@@ -1,57 +0,0 @@
1
- from pathlib import Path
2
- from setuptools import setup
3
-
4
- version = "3.0.0a2"
5
-
6
- long_description = (
7
- f"{Path('README.rst').read_text()}\n"
8
- f"{Path('CHANGES.rst').read_text()}\n"
9
- f"{(Path('docs') / 'usage.rst').read_text()}"
10
- )
11
-
12
- setup(
13
- name="plone.batching",
14
- version=version,
15
- description="Batching facilities used in Plone",
16
- long_description=long_description,
17
- long_description_content_type="text/x-rst",
18
- # Get more strings from
19
- # https://pypi.org/classifiers/
20
- classifiers=[
21
- "Development Status :: 5 - Production/Stable",
22
- "Environment :: Web Environment",
23
- "Framework :: Plone",
24
- "Framework :: Plone :: 6.2",
25
- "Framework :: Plone :: Core",
26
- "Framework :: Zope :: 5",
27
- "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
28
- "Operating System :: OS Independent",
29
- "Programming Language :: Python",
30
- "Programming Language :: Python :: 3.10",
31
- "Programming Language :: Python :: 3.11",
32
- ],
33
- keywords="Plone",
34
- author="Plone Foundation",
35
- author_email="plone-developers@lists.sourceforge.net",
36
- url="https://pypi.org/project/plone.batching",
37
- license="GPL",
38
- include_package_data=True,
39
- zip_safe=False,
40
- python_requires=">=3.10",
41
- install_requires=[
42
- "AccessControl",
43
- "Zope",
44
- "zope.interface",
45
- "zope.schema",
46
- ],
47
- extras_require={
48
- "test": [
49
- "zope.component",
50
- "zope.publisher",
51
- ],
52
- },
53
- entry_points="""
54
- [z3c.autoinclude.plugin]
55
- target = plone
56
- """,
57
- )
@@ -1,2 +0,0 @@
1
- [z3c.autoinclude.plugin]
2
- target = plone