[Zope-Checkins] CVS: Products/ZCatalog - Lazy.py:1.4.36.1
andreasjung@cvs.baymountain.com
andreasjung@cvs.baymountain.com
Tue, 24 Jul 2001 16:45:31 -0400
Update of /cvs-repository/Products/ZCatalog
In directory cvs.zope.org:/tmp/cvs-serv26356/lib/python/Products/ZCatalog
Modified Files:
Tag: Zope-2_4-branch
Lazy.py
Log Message:
- Collector #2438: Using a slice operation like [30:] on a
ZCatalog search result caused a MemoryError because
the __getslice__ implementation used range() instead
of xrange().
=== Products/ZCatalog/Lazy.py 1.4 => 1.4.36.1 ===
# for accessing small parts of big searches.
- def __init__(self, sequences):
+ def __init__(self, sequences, length=None):
self._seq=sequences
self._data=[]
self._sindex=0
self._eindex=-1
+ if length is not None: self._len=length
def __getitem__(self,index):
@@ -194,11 +195,12 @@
# Act like a sequence, but get data from a filtering process.
# Don't access data until necessary
- def __init__(self,func,seq):
+ def __init__(self, func, seq, length=None):
self._seq=seq
- self._len=len(seq)
self._data=[]
self._func=func
+ if length is not None: self._len=length
+ else: self._len = len(seq)
def __getitem__(self,index):
@@ -229,7 +231,7 @@
# Act like a sequence, but get data from a filtering process.
# Don't access data until necessary
- def __init__(self,test,seq):
+ def __init__(self, test, seq):
self._seq=seq
self._data=[]
self._eindex=-1
@@ -270,7 +272,7 @@
# Act like a sequence, but get data from a filtering process.
# Don't access data until necessary
- def __init__(self,test,seq):
+ def __init__(self, test, seq):
self._seq=seq
self._data=[]
self._eindex=-1