[Zope-Checkins] CVS: Products/PluginIndexes/PathIndex - PathIndex.py:1.5

Andreas Jung andreas@zope.com
Mon, 27 Aug 2001 21:05:32 -0400


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

Modified Files:
	PathIndex.py 
Log Message:
added optional level parameter on per-path basis


=== Products/PluginIndexes/PathIndex/PathIndex.py 1.4 => 1.5 ===
 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)