[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/PathIndex - PathIndex.py:1.4.4.1 __init__.py:1.2.4.2

Andreas Jung andreas@zope.com
Tue, 4 Sep 2001 11:20:48 -0400


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

Modified Files:
      Tag: Zope-2_4-branch
	PathIndex.py __init__.py 
Log Message:
PathIndex queries now take an optional 'level' parameter on the
query level



=== Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 1.4 => 1.4.4.1 ===
 from BTrees.OIBTree import OIBTree
 from BTrees.IIBTree import IISet,difference,intersection,union
+from types import StringType
 import re
 
 
@@ -233,12 +234,21 @@
         return comps
 
 
-    def search(self,path,level=0):
+    def search(self,path,default_level=0):
         """
-        path is a list of path components to be searched
+        path is either a string representing a
+        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
         """       
+
+        if isinstance(path,StringType):
+            level = default_level
+        else:
+            level = path[1]
+            path  = path[0]
 
         comps = self.splitPath(path)
         


=== Zope/lib/python/Products/PluginIndexes/PathIndex/__init__.py 1.2.4.1 => 1.2.4.2 ===
+# empty comment for winzip and friends