[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/index - subscribers.py:1.5
Guido van Rossum
guido@python.org
Mon, 9 Dec 2002 17:24:51 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/index
In directory cvs.zope.org:/tmp/cvs-serv1009
Modified Files:
subscribers.py
Log Message:
findContentObject(): look specifically for '++etc++Services' in the
location, not just for something starting with '++etc++'. See
SteveA's comments on my diary in the Zope3-dev list.
=== Zope3/lib/python/Zope/App/index/subscribers.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/App/index/subscribers.py:1.4 Sun Dec 8 17:05:49 2002
+++ Zope3/lib/python/Zope/App/index/subscribers.py Mon Dec 9 17:24:50 2002
@@ -124,16 +124,16 @@
def findContentObject(context):
# We want to find the (content) Folder in whose service manager we
# live. There are man y way to do this. Perhaps the simplest is
- # looking for '++etc++...' in the location. We could also walk up
- # the path looking for something that implements IFolder; the
- # service manager and packages don't implement this. Or (perhaps
- # better, because a service manager might be attached to a
- # non-folder container) assume we're in service space, and walk up
- # until we find a service manager, and then go up one more step.
- # Walking up the path could be done by stripping components from
- # the end of the path one at a time and doing a lookup each time,
- # or more directly by traversing the context. Traversing the
- # context can be done by getting the context and following the
+ # looking for '++etc++Services' in the location. We could also
+ # walk up the path looking for something that implements IFolder;
+ # the service manager and packages don't implement this. Or
+ # (perhaps better, because a service manager might be attached to
+ # a non-folder container) assume we're in service space, and walk
+ # up until we find a service manager, and then go up one more
+ # step. Walking up the path could be done by stripping components
+ # from the end of the path one at a time and doing a lookup each
+ # time, or more directly by traversing the context. Traversing
+ # the context can be done by getting the context and following the
# chain back; there's a convenience class, ContainmentIterator to
# do that. Use the version of ContainmentIterator from
# Zope.Proxy, which is aware of the complications caused by
@@ -143,10 +143,10 @@
location = getPhysicalPath(context)
# Location is a tuple of strings, starting with '' (for the root)
for i in range(len(location)):
- if location[i].startswith("++etc++"):
+ if location[i] == "++etc++Services":
location = location[:i]
break
else:
- raise ValueError, "can't find ++etc++ in path"
+ raise ValueError, "can't find '++etc++Services' in path"
root = getPhysicalRoot(context)
return traverse(root, location)