[Zope3-checkins] CVS: Zope3/src/zope/app/adapter - adapter.py:1.9 tests.py:1.8

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Apr 17 10:33:41 EDT 2004


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

Modified Files:
	adapter.py tests.py 
Log Message:


Expanded local registry registrations() to
registrations(localOnly=False). When localOnly is set to True, show only
registrations made in this service.



Renamed zope.component.interfaces.IComponentRegistry to IRegistry and
zope.app.registration.interfaces.IRegistry extends now the
zope.component.interfaces.IRegistry.




=== Zope3/src/zope/app/adapter/adapter.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/adapter/adapter.py:1.8	Thu Apr 15 11:29:36 2004
+++ Zope3/src/zope/app/adapter/adapter.py	Sat Apr 17 10:33:06 2004
@@ -67,7 +67,6 @@
 
     zope.interface.implements(
         zope.app.registration.interfaces.IRegistry,
-        zope.component.interfaces.IComponentRegistry,
         )
     
     _surrogateClass = LocalSurrogate
@@ -250,7 +249,6 @@
     zope.interface.implements(
         zope.component.interfaces.IAdapterService,
         zope.app.site.interfaces.ISimpleService,
-        zope.component.interfaces.IComponentRegistry,
         )
 
     serviceType = zapi.servicenames.Adapters
@@ -260,9 +258,12 @@
             base = zapi.getService(None, self.serviceType)
         LocalAdapterRegistry.__init__(self, base)
 
-    def registrations(self):
+    def registrations(self, localOnly=False):
         for registration in LocalAdapterRegistry.registrations(self):
             yield registration
+
+        if localOnly is True:
+            return
 
         next = self.next
         if next is None:


=== Zope3/src/zope/app/adapter/tests.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/adapter/tests.py:1.7	Thu Apr  8 17:31:39 2004
+++ Zope3/src/zope/app/adapter/tests.py	Sat Apr 17 10:33:06 2004
@@ -806,7 +806,7 @@
        those "above" them.
 
        Suppose we have a global adapter service, which is a type of
-       adapter registry that is an IComponentRegistry:
+       adapter registry that is an zope.component.interfaces.IRegistry:
 
        >>> G = GlobalAdapterService()
 
@@ -853,6 +853,14 @@
        Registration('IF0', (), 'IB1', u'', 'A011')
        Registration('IF1', (), 'IB0', u'', 'A102')
        Registration('IF1', (), 'IB1', u'', 'A112')
+
+       Now we just want the local registrations for L1:
+
+       >>> registrations = map(repr, L1.registrations(localOnly=True))
+       >>> registrations.sort()
+       >>> for registration in registrations:
+       ...     print registration
+       Registration('IF0', (), 'IB1', u'', 'A011')
 
        $Id$
        """




More information about the Zope3-Checkins mailing list