[Zope3-checkins] CVS: Zope3/src/zope/app/component - nextservice.py:1.8.6.1

Jim Fulton cvs-admin at zope.org
Tue Nov 11 12:28:23 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/component
In directory cvs.zope.org:/tmp/cvs-serv28715/src/zope/app/component

Modified Files:
      Tag: adaptergeddon-branch
	nextservice.py 
Log Message:
Changed local site managers (aka service managers) to have next and
subSites attributes.  Now local service managers are linked up to make
it easier to navigate related sites.


=== Zope3/src/zope/app/component/nextservice.py 1.8 => 1.8.6.1 ===
--- Zope3/src/zope/app/component/nextservice.py:1.8	Sun Sep 21 13:31:26 2003
+++ Zope3/src/zope/app/component/nextservice.py	Tue Nov 11 12:27:52 2003
@@ -16,6 +16,7 @@
 $Id$
 """
 
+from zope.component.servicenames import Services
 from zope.component.exceptions import ComponentLookupError
 from zope.component.service import serviceManager
 from zope.proxy import removeAllProxies
@@ -47,33 +48,9 @@
     """if the context is a service manager or a placeful service, tries
     to return the next highest service manager"""
 
-    # IMPORTANT
-    #
-    # This is not allowed to use any services to get it's job done!
-
     # get this service manager
     sm = getServiceManager_hook(context)
-    if sm is serviceManager:
-        raise ComponentLookupError('Services')
-
-    # get the service manager container, which ought to be the context
-    # contaioner.
-    container = sm.__parent__
-
-    # But we're *really* paranoid, so we'll double check.
-    while ((container is not None) and not
-           ISite.isImplementedBy(removeAllProxies(container))
-           ):
-        container = container.__parent__ # we should be
-
-    # Now we need to step up so we can look for a service manager above.
-    context = getattr(container, '__parent__', None)
-
-    # But we have to make sure we haven't got the same object..
-    while (context is not None) and (context == container):
-        context = context.__parent__
-
-    if context is None:
-        return serviceManager
-
-    return getServiceManager_hook(context, local=True)
+    try:
+        return sm.next
+    except AttributeError:
+        raise ComponentLookupError(Services)




More information about the Zope3-Checkins mailing list