Commit c1c0aec4 authored by Andreas Jung's avatar Andreas Jung

added optional level parameter on per-path basis

parent dcd0edca
...@@ -63,6 +63,13 @@ Zope Changes ...@@ -63,6 +63,13 @@ Zope Changes
then HTTP version could not be determined from the HTTP request. then HTTP version could not be determined from the HTTP request.
Now sending "HTTP/1.0..." Now sending "HTTP/1.0..."
- queries for the PathIndex can now specified as tuple (path,level).
the level parameter inside a query overrides the optional
'level' parameter for a complete search request.
Zope 2.4 beta 2 Zope 2.4 beta 2
Bugs fixed Bugs fixed
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__version__ = '$Id: PathIndex.py,v 1.4 2001/06/01 18:53:39 andreas Exp $' __version__ = '$Id: PathIndex.py,v 1.5 2001/08/28 01:05:31 andreasjung Exp $'
from Products.PluginIndexes import PluggableIndex from Products.PluginIndexes import PluggableIndex
from Products.PluginIndexes.common.util import parseIndexRequest from Products.PluginIndexes.common.util import parseIndexRequest
...@@ -97,6 +97,7 @@ from BTrees.IOBTree import IOBTree ...@@ -97,6 +97,7 @@ from BTrees.IOBTree import IOBTree
from BTrees.OOBTree import OOBTree,OOSet from BTrees.OOBTree import OOBTree,OOSet
from BTrees.OIBTree import OIBTree from BTrees.OIBTree import OIBTree
from BTrees.IIBTree import IISet,difference,intersection,union from BTrees.IIBTree import IISet,difference,intersection,union
from types import StringType
import re import re
...@@ -233,13 +234,22 @@ class PathIndex(PluggableIndex.PluggableIndex, Persistent, ...@@ -233,13 +234,22 @@ class PathIndex(PluggableIndex.PluggableIndex, Persistent,
return comps 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 starts searching at the given level
level<0 not implemented yet level<0 not implemented yet
""" """
if isinstance(path,StringType):
level = default_level
else:
level = path[1]
path = path[0]
comps = self.splitPath(path) comps = self.splitPath(path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment