[Zope-Checkins] CVS: Zope2 - UnIndex.py:1.28
Jim Fulton
jim@digicool.com
Fri, 16 Mar 2001 19:48:59 -0500 (EST)
Update of /cvs-repository/Zope2/lib/python/SearchIndex
In directory korak:/tmp/cvs-serv27617
Modified Files:
UnIndex.py
Log Message:
Fixed to take account of the posibility of some new data structures
mixed with old.
Need to copy length value to __len__.
--- Updated File UnIndex.py in package Zope2 --
--- UnIndex.py 2001/03/16 08:47:38 1.27
+++ UnIndex.py 2001/03/17 00:48:59 1.28
@@ -169,10 +169,17 @@
_index=self._index
self._index=OOBTree()
- def convertSet(s, IITreeSet=IITreeSet):
+ def convertSet(s,
+ IITreeSet=IITreeSet, IntType=type(0),
+ type=type, len=len,
+ doneTypes = (IntType, IITreeSet)):
+
+ if type(s) in doneTypes: return s
+
if len(s) == 1:
try: return s[0] # convert to int
except: pass # This is just an optimization.
+
return IITreeSet(s)
convert(_index, self._index, threshold, convertSet)
@@ -181,7 +188,7 @@
self._unindex=IOBTree()
convert(_unindex, self._unindex, threshold)
- self.__len__=BTrees.Length.Length()
+ self.__len__=BTrees.Length.Length(len(_index))
def __nonzero__(self):
return not not self._unindex