[Zope3-checkins] CVS: Zope3/src/zope/component - __init__.py:1.29

Jim Fulton jim at zope.com
Sun Apr 11 14:16:40 EDT 2004


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

Modified Files:
	__init__.py 
Log Message:
Reimplemented getFactoriesFor in terms of getUtilitiesFor


=== Zope3/src/zope/component/__init__.py 1.28 => 1.29 ===
--- Zope3/src/zope/component/__init__.py:1.28	Wed Mar 31 18:26:25 2004
+++ Zope3/src/zope/component/__init__.py	Sun Apr 11 14:16:40 2004
@@ -175,9 +175,16 @@
 
 def getFactoriesFor(context, interface):
     utils =  getService(context, 'Utilities')
-    return [(name, factory)
-            for iface, name, factory in utils.getRegisteredMatching(IFactory)
-            if interface in tuple(factory.getInterfaces())]
+    for (name, factory) in utils.getUtilitiesFor(IFactory):
+        interfaces = factory.getInterfaces()
+        try:
+            if interfaces.isOrExtends(interface):
+                yield name, factory
+        except AttributeError:
+            for iface in interfaces:
+                if iface.isOrExtends(interface):
+                    yield name, factory
+                    break
 
 def getFactory(context, name):
     warnings.warn(




More information about the Zope3-Checkins mailing list