[ZPT] CVS: Releases/Zope/lib/python/ZTUtils - Batch.py:1.9 CHANGES.txt:1.9
Evan Simpson
evan@zope.com
Fri, 15 Mar 2002 16:47:39 -0500
Update of /cvs-repository/Releases/Zope/lib/python/ZTUtils
In directory cvs.zope.org:/tmp/cvs-serv21926
Modified Files:
Batch.py CHANGES.txt
Log Message:
Rename 'total' to 'sequence_length' and make it lazy.
=== Releases/Zope/lib/python/ZTUtils/Batch.py 1.8 => 1.9 ===
parent.orphan, parent.overlap)
+class LazySequenceLength(Base):
+ def __of__(self, parent):
+ parent.sequence_length = l = len(parent._sequence)
+ return l
+
class Batch(Base):
"""Create a sequence batch"""
__allow_access_to_unprotected_subobjects__ = 1
previous = LazyPrevBatch()
next = LazyNextBatch()
+ sequence_length = LazySequenceLength()
def __init__(self, sequence, size, start=0, end=0,
orphan=0, overlap=0):
@@ -54,7 +60,7 @@
0-based index. "length" is the actual number of elements in
the batch.
- "total" is the length of the original, unbatched, sequence
+ "sequence_length" is the length of the original, unbatched, sequence
'''
start = start + 1
@@ -70,7 +76,6 @@
self.overlap = overlap
self.first = max(start - 1, 0)
self.length = self.end - self.first
- self.total = len(sequence)
if self.first == 0:
self.previous = None
=== Releases/Zope/lib/python/ZTUtils/CHANGES.txt 1.8 => 1.9 ===
file HISTORY.txt.
- After Version 1.1.3
+ After Version 1.1.4
Features Added
- - Added useful 'total' attribute to batches.
+ - Added 'sequence_length' attribute to batches.
Version 1.1.4