[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/utility - __init__.py:1.4

Fred L. Drake, Jr. fred@zope.com
Tue, 1 Jul 2003 14:58:07 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/services/utility
In directory cvs.zope.org:/tmp/cvs-serv23356

Modified Files:
	__init__.py 
Log Message:
- use zope.app.zapi
- fix resolution of interface name


=== Zope3/src/zope/app/browser/services/utility/__init__.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/utility/__init__.py:1.3	Sun Jun 22 10:02:03 2003
+++ Zope3/src/zope/app/browser/services/utility/__init__.py	Tue Jul  1 14:58:07 2003
@@ -24,7 +24,7 @@
 from zope.app.interfaces.services.registration import RegisteredStatus
 from zope.app.interfaces.services.registration import UnregisteredStatus
 from zope.app.traversing import getPath, getParent, getName
-from zope.component import getServiceManager, getView, getAdapter
+from zope.app import zapi
 from zope.interface import providedBy
 from zope.proxy import removeAllProxies
 from zope.publisher.browser import BrowserView
@@ -77,7 +77,7 @@
             if doActivate or doDeactivate or doDelete:
                 return "Please select at least one checkbox"
             return None
-        sm = getServiceManager(self.context)
+        sm = zapi.getServiceManager(self.context)
         todo = []
         for key in selected:
             name, ifacename = key.split(":", 1)
@@ -151,14 +151,14 @@
                 conf.status = UnregisteredStatus
                 parent = getParent(conf)
                 name = getName(conf)
-                container = getAdapter(parent, IZopeContainer)
+                container = zapi.getAdapter(parent, IZopeContainer)
                 del container[name]
 
         # 2) Delete the service objects
         for path, obj in services.items():
             parent = getParent(obj)
             name = getName(obj)
-            container = getAdapter(parent, IZopeContainer)
+            container = zapi.getAdapter(parent, IZopeContainer)
             del container[name]
 
         return "Deleted: %s" % ", ".join(done)
@@ -178,9 +178,9 @@
                                % (ifname, name)),
                  }
             if active is not None:
-                d["url"] = str(getView(active.getComponent(),
-                                       "absolute_url",
-                                       self.request))
+                d["url"] = str(zapi.getView(active.getComponent(),
+                                            "absolute_url",
+                                            self.request))
             L.append((ifname, name, d))
         L.sort()
         return [d for ifname, name, d in L]
@@ -188,11 +188,11 @@
 
 class ConfigureUtility(BrowserView):
     def update(self):
-        sm = getServiceManager(self.context)
-        iface = sm.resolve(self.request['interface'])
+        folder = zapi.getWrapperContainer(self.context)
+        iface = folder.resolve(self.request['interface'])
         name = self.request['name']
         cr = self.context.queryRegistrations(name, iface)
-        form = getView(cr, "ChangeRegistrations", self.request)
+        form = zapi.getView(cr, "ChangeRegistrations", self.request)
         form.update()
         return form