[ZPT] CVS: Releases/Zope/lib/python/ZTUtils - Batch.py:1.7 Zope.py:1.8

Evan Simpson evan@zope.com
Fri, 15 Feb 2002 11:26:57 -0500


Update of /cvs-repository/Releases/Zope/lib/python/ZTUtils
In directory cvs.zope.org:/tmp/cvs-serv25640

Modified Files:
	Batch.py Zope.py 
Log Message:
Merge fixes from Zope-2_5-branch.


=== Releases/Zope/lib/python/ZTUtils/Batch.py 1.6 => 1.7 ===
     def __of__(self, parent):
         return Batch(parent._sequence, parent._size,
-                     -1, parent.first + parent.overlap,
+                     parent.first - parent._size + parent.overlap, 0,
                      parent.orphan, parent.overlap)
 
 class LazyNextBatch(Base):
@@ -40,6 +40,20 @@
     
     def __init__(self, sequence, size, start=0, end=0,
                  orphan=0, overlap=0):
+        '''Encapsulate "sequence" in batches of "size".
+
+        Arguments: "start" and "end" are 0-based indexes into the
+        sequence.  If the next batch would contain no more than
+        "orphan" elements, it is combined with the current batch.
+        "overlap" is the number of elements shared by adjacent
+        batches.  If "size" is not specified, it is computed from
+        "start" and "end".  Failing that, it is 7.
+
+        Attributes: Note that the "start" attribute, unlike the
+        argument, is a 1-based index (I know, lame).  "first" is the
+        0-based index.  "length" is the actual number of elements in
+        the batch.
+        '''
 
         start = start + 1
 


=== Releases/Zope/lib/python/ZTUtils/Zope.py 1.7 => 1.8 ===
 class Batch(Batch):
     def __init__(self, sequence, size, start=0, end=0,
-                 orphan=3, overlap=0, skip_unauthorized=None):
+                 orphan=0, overlap=0, skip_unauthorized=None):
         sequence = LazyFilter(sequence, skip=skip_unauthorized)
         _Batch.__init__(self, sequence, size, start, end,
                         orphan, overlap)