[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/PathIndex - PathIndex.py:1.27

Andreas Jung andreas@digicool.com
Thu, 3 Oct 2002 09:10:49 -0400


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/PathIndex
In directory cvs.zope.org:/tmp/cvs-serv15820/lib/python/Products/PluginIndexes/PathIndex

Modified Files:
	PathIndex.py 
Log Message:
Collector #449: PathIndex did not index last part of path


=== Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 1.26 => 1.27 ===
--- Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py:1.26	Tue Sep 24 07:03:24 2002
+++ Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py	Thu Oct  3 09:10:49 2002
@@ -126,8 +126,8 @@
 
         comps = self.splitPath(path,obj)
 
-        if obj.meta_type != 'Folder':
-            comps = comps[:-1]
+#        if obj.meta_type != 'Folder':
+#            comps = comps[:-1]
 
         for i in range(len(comps)):
             self.insertEntry( comps[i],documentId,i)
@@ -146,7 +146,7 @@
         path = self._unindex[documentId]
         comps = path.split('/')
 
-        for level in range(len(comps[1:])-1):
+        for level in range(len(comps[1:])):
             comp = comps[level+1]
 
             self._index[comp][level].remove(documentId)
@@ -190,8 +190,8 @@
         relative URL or a part of a relative URL or
         a tuple (path,level).
 
-        level >= 0  starts searching at the given level
-        level <  0  not implemented yet
+        level>=0  starts searching at the given level
+        level<0   not implemented yet
         """
 
         if isinstance(path,StringType):
@@ -202,10 +202,7 @@
 
         comps = self.splitPath(path)
 
-        if len(comps) == 0:
-            return IISet(self._unindex.keys())
-
-        if level >= 0:
+        if level >=0:
 
             results = []
             for i in range(len(comps)):
@@ -228,7 +225,7 @@
 
             results = IISet()
 
-            for level in range(0,self._depth):
+            for level in range(0,self._depth + 1):
 
                 ids = None
                 error = 0
@@ -238,7 +235,7 @@
 
                     try:
                         ids = intersection(ids,self._index[comp][level+cn])
-                    except:
+                    except KeyError:
                         error = 1
 
                 if error==0: