[Zope3-checkins] CVS: Zope3/src/zope/app/component - configure.zcml:1.9.6.2 globalinterfaceservice.py:1.17.12.1

Jim Fulton cvs-admin at zope.org
Tue Nov 18 17:26:56 EST 2003


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

Modified Files:
      Tag: adaptergeddon-branch
	configure.zcml globalinterfaceservice.py 
Log Message:
Implemented local presentation services.


=== Zope3/src/zope/app/component/configure.zcml 1.9.6.1 => 1.9.6.2 ===
--- Zope3/src/zope/app/component/configure.zcml:1.9.6.1	Sun Nov  9 11:08:14 2003
+++ Zope3/src/zope/app/component/configure.zcml	Tue Nov 18 17:26:25 2003
@@ -14,7 +14,7 @@
              interface='zope.component.interfaces.IAdapterService' />
 <service serviceType='Adapters'
          permission='zope.Public'
-         component='zope.component.adapter.adapterService' />
+         factory='zope.component.adapter.GlobalAdapterService' />
 
 <serviceType id='Factories'
              interface='zope.component.interfaces.IFactoryService' />


=== Zope3/src/zope/app/component/globalinterfaceservice.py 1.17 => 1.17.12.1 ===
--- Zope3/src/zope/app/component/globalinterfaceservice.py:1.17	Sun Aug 17 02:06:15 2003
+++ Zope3/src/zope/app/component/globalinterfaceservice.py	Tue Nov 18 17:26:25 2003
@@ -21,9 +21,10 @@
 from zope.component.exceptions import ComponentLookupError
 from zope.component import getService
 from zope.app.interfaces.component import IGlobalInterfaceService
-from zope.interface import implements, providedBy
+from zope.interface import implements, providedBy, implementedBy
 from zope.interface.interfaces import IInterface
 from zope.component.utility import utilityService
+from types import ClassType
 
 class InterfaceService:
     implements(IGlobalInterfaceService)
@@ -73,11 +74,13 @@
             yield id, interface
 
     def _getAllDocs(self,interface):
-        docs = [str(interface.getName()).lower(),
+        docs = [str(interface.__name__).lower(),
                 str(interface.__doc__).lower()]
 
-        for name in interface:
-            docs.append(str(interface.getDescriptionFor(name).__doc__).lower())
+        if IInterface.isImplementedBy(interface):
+            for name in interface:
+                docs.append(
+                    str(interface.getDescriptionFor(name).__doc__).lower())
 
         return '\n'.join(docs)
 
@@ -95,7 +98,12 @@
 
     def provideInterface(self, id, interface):
         if not id:
-            id = "%s.%s" % (interface.__module__, interface.getName())
+            id = "%s.%s" % (interface.__module__, interface.__name__)
+
+        if not IInterface.isImplementedBy(interface):
+            if not isinstance(interface, (type, ClassType)):
+                raise TypeError(id, "is not an interface or class")
+            interface = implementedBy(interface)
 
         self.__data[id]=(interface, self._getAllDocs(interface))
 




More information about the Zope3-Checkins mailing list