[Checkins] SVN: zope.app.apidoc/trunk/ Apply refactoring from #153309

Christian Theune ct at gocept.com
Sat Apr 24 06:36:46 EDT 2010


Log message for revision 111337:
  Apply refactoring from #153309
  

Changed:
  U   zope.app.apidoc/trunk/CHANGES.txt
  U   zope.app.apidoc/trunk/src/zope/app/apidoc/component.py

-=-
Modified: zope.app.apidoc/trunk/CHANGES.txt
===================================================================
--- zope.app.apidoc/trunk/CHANGES.txt	2010-04-24 10:34:16 UTC (rev 111336)
+++ zope.app.apidoc/trunk/CHANGES.txt	2010-04-24 10:36:46 UTC (rev 111337)
@@ -5,6 +5,8 @@
 3.7.3 (unreleased)
 ------------------
 
+- Apply refactoring from #153309.
+
 3.7.2 (2010-03-07)
 ------------------
 

Modified: zope.app.apidoc/trunk/src/zope/app/apidoc/component.py
===================================================================
--- zope.app.apidoc/trunk/src/zope/app/apidoc/component.py	2010-04-24 10:34:16 UTC (rev 111336)
+++ zope.app.apidoc/trunk/src/zope/app/apidoc/component.py	2010-04-24 10:36:46 UTC (rev 111337)
@@ -54,23 +54,19 @@
 def getRequiredAdapters(iface, withViews=False):
     """Get adapter registrations where the specified interface is required."""
     gsm = getGlobalSiteManager()
-    for meth in ('registeredAdapters',
-                 'registeredSubscriptionAdapters',
-                 'registeredHandlers'):
+    for reg in _adapterishRegistrations(gsm):
+        # Ignore adapters that have no required interfaces
+        if len(reg.required) == 0:
+            continue
+        # Ignore views
+        if not withViews and reg.required[-1].isOrExtends(IRequest):
+            continue
+        # Only get the adapters for which this interface is required
+        for required_iface in reg.required:
+            if iface.isOrExtends(required_iface):
+                yield reg
 
-        for reg in getattr(gsm, meth)():
-            # Ignore adapters that have no required interfaces
-            if len(reg.required) == 0:
-                continue
-            # Ignore views
-            if not withViews and reg.required[-1].isOrExtends(IRequest):
-                continue
-            # Only get the adapters for which this interface is required
-            for required_iface in reg.required:
-                if iface.isOrExtends(required_iface):
-                    yield reg
 
-
 def getProvidedAdapters(iface, withViews=False):
     """Get adapter registrations where this interface is provided."""
     gsm = getGlobalSiteManager()



More information about the checkins mailing list