[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/app/ Use newer registration apis

Jim Fulton jim at zope.com
Sun Apr 2 18:52:48 EDT 2006


Log message for revision 66338:
  Use newer registration apis
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py
  U   Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py	2006-04-02 22:05:43 UTC (rev 66337)
+++ Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py	2006-04-02 22:52:47 UTC (rev 66338)
@@ -114,9 +114,7 @@
     """Return the factory registrations, who will return objects providing this
     interface."""
     gsm = zapi.getGlobalSiteManager()
-    for reg in gsm.registrations():
-        if not isinstance(reg, UtilityRegistration):
-            continue
+    for reg in gsm.registeredUtilities():
         if reg.provided is not IFactory:
             continue
         interfaces = reg.component.getInterfaces()
@@ -133,9 +131,7 @@
 def getUtilities(iface):
     """Return all utility registrations that provide the interface."""
     gsm = zapi.getGlobalSiteManager()
-    for reg in gsm.registrations():
-        if not isinstance(reg, UtilityRegistration):
-            continue
+    for reg in gsm.registeredUtilities():
         if reg.provided.isOrExtends(iface):
             yield reg
 

Modified: Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py	2006-04-02 22:05:43 UTC (rev 66337)
+++ Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_interfaceutility.py	2006-04-02 22:52:47 UTC (rev 66338)
@@ -200,21 +200,14 @@
         default = traverse(self.rootFolder, "++etc++site/default")
         default['foo'] = Foo("local")
         foo = default['foo']
-        cm = default.registrationManager
 
         for name in ('', 'bob'):
-            registration = UtilityRegistration(name, IInterface, foo)
-            cname = cm.addRegistration(registration)
-            registration = traverse(cm, cname)
-
             gout = name and "foo global "+name or "foo global"
             self.assertEqual(sm.queryUtility(IInterface, name).foo(), gout)
-
-            registration.status = ActiveStatus
+            sm.registerUtility(foo, IInterface, name)
             self.assertEqual(
                 sm.queryUtility(IInterface, name).foo(), "foo local")
-
-            registration.status = InactiveStatus
+            sm.unregisterUtility(foo, IInterface, name)
             self.assertEqual(sm.queryUtility(IInterface, name).foo(), gout)
 
 



More information about the Zope3-Checkins mailing list