[Checkins] SVN: z3c.batching/trunk/ Really fixed the bug with batches slicing
Christophe Combelles
ccomb at free.fr
Sat Oct 11 08:17:30 EDT 2008
Log message for revision 92034:
Really fixed the bug with batches slicing
Changed:
U z3c.batching/trunk/CHANGES.txt
U z3c.batching/trunk/src/z3c/batching/README.txt
U z3c.batching/trunk/src/z3c/batching/batch.py
-=-
Modified: z3c.batching/trunk/CHANGES.txt
===================================================================
--- z3c.batching/trunk/CHANGES.txt 2008-10-11 11:45:14 UTC (rev 92033)
+++ z3c.batching/trunk/CHANGES.txt 2008-10-11 12:17:30 UTC (rev 92034)
@@ -8,6 +8,8 @@
- Added a function to build a small neighbourhood list of the current batch,
from a large batch list. (extracted from z3c.table)
+- Really fixed the bug with batches slicing
+
1.0.1 (2008-09-09)
------------------
Modified: z3c.batching/trunk/src/z3c/batching/README.txt
===================================================================
--- z3c.batching/trunk/src/z3c/batching/README.txt 2008-10-11 11:45:14 UTC (rev 92033)
+++ z3c.batching/trunk/src/z3c/batching/README.txt 2008-10-11 12:17:30 UTC (rev 92034)
@@ -193,7 +193,7 @@
>>> batch.total
4
-We can get access to all batches::
+We can have access to all batches::
>>> len(batch.batches)
4
@@ -232,6 +232,9 @@
>>> batch.batches[10:]
[]
+ >>> batch.batches[2:50]
+ [<Batch start=6, size=3>, <Batch start=9, size=3>]
+
Batch neighbourhood of a large batch list
-----------------------------------------
Modified: z3c.batching/trunk/src/z3c/batching/batch.py
===================================================================
--- z3c.batching/trunk/src/z3c/batching/batch.py 2008-10-11 11:45:14 UTC (rev 92033)
+++ z3c.batching/trunk/src/z3c/batching/batch.py 2008-10-11 12:17:30 UTC (rev 92034)
@@ -179,9 +179,7 @@
raise IndexError(key)
def __getslice__(self, i, j):
- if j > self.total:
- j = self.total-1
-
+ j = min(j, self.total)
return [self[idx] for idx in range(i, j)]
More information about the Checkins
mailing list