[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ServiceManager - ServiceManager.py:1.1.4.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 15:34:52 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ServiceManager
In directory cvs.zope.org:/tmp/cvs-serv5490/lib/python/Zope/App/OFS/Services/ServiceManager

Modified Files:
      Tag: Zope-3x-branch
	ServiceManager.py 
Log Message:
Implemented 

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/IContainerPythonification

Along the way:

- Converted most uses of has_key to use in.

- Fixed a bug in Interface names and namesAndDescriptions methods 
  that caused base class attributes to be missed.



=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/ServiceManager.py 1.1.4.1 => 1.1.4.2 ===
             serviceDefs.update(dict(
                removeAllProxies(
-                   wrapped_self.getObject(serviceInterfaceServ).objectItems()
+                   wrapped_self[serviceInterfaceServ].items()
                    )
                ))
         return serviceDefs
@@ -72,7 +72,7 @@
         service = clean_self.__bindings.get(name)
 
         if service:
-            return ContextWrapper(wrapped_self.getObject(service),
+            return ContextWrapper(wrapped_self[service],
                                   wrapped_self, name=service) # we want
         # to traverse by component name, not service name
 
@@ -90,9 +90,7 @@
         clean_self=removeAllProxies(wrapped_self)
 
         # This could raise a KeyError if we don't have this component
-        clean_serviceComponent = wrapped_self.getObject(
-            serviceComponentName
-           )
+        clean_serviceComponent = wrapped_self[serviceComponentName]
         wrapped_serviceComponent=ContextWrapper(
             clean_serviceComponent,
             wrapped_self,
@@ -125,9 +123,7 @@
         clean_self=removeAllProxies(wrapped_self)
         serviceComponentName=clean_self.__bindings[serviceName]
         
-        clean_serviceComponent = wrapped_self.getObject(
-            serviceComponentName
-           )
+        clean_serviceComponent = wrapped_self[serviceComponentName]
         wrapped_serviceComponent=ContextWrapper(
             clean_serviceComponent,
             wrapped_self,
@@ -144,11 +140,11 @@
     unbindService=ContextMethod(unbindService)
 
 
-    def delObject(self, name):
+    def __delitem__(self, name):
         '''See interface IWriteContainer'''
         if name in self.__bindings.values():
             # Should we silently unbind the service?
             # self.unbindService(name)
             # No, let's raise an exception
             raise ZopeError("Cannot remove a bound service. Unbind it first.")
-        BTreeContainer.delObject(self, name)
+        BTreeContainer.__delitem__(self, name)