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

Jim Fulton jim at zope.com
Thu Apr 15 11:29:37 EDT 2004


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

Modified Files:
	adapter.py 
Log Message:
Added a method to notify a service when the global service has
changed. This should only be needed during testing, hence the lack of
a more automated approach.

Abstracted the service type out, so that we cab use this same code for
the utility service.


=== Zope3/src/zope/app/adapter/adapter.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/adapter/adapter.py:1.7	Mon Apr 12 13:58:33 2004
+++ Zope3/src/zope/app/adapter/adapter.py	Thu Apr 15 11:29:36 2004
@@ -178,6 +178,16 @@
 
     notifyActivated = notifyDeactivated = adaptersChanged
 
+    def baseChanged(self):
+        """Someone changed the base service
+
+        This should only happen during testing
+        """
+        AdapterRegistry.__init__(self)
+        for sub in self.subs:
+            sub.baseChanged()
+                
+
     def registrations(self):
         for stacks in self.stacks.itervalues():
             for stack in stacks.itervalues():
@@ -243,9 +253,11 @@
         zope.component.interfaces.IComponentRegistry,
         )
 
+    serviceType = zapi.servicenames.Adapters
+
     def __init__(self, base=None):
         if base is None:
-            base = zapi.getService(None, zapi.servicenames.Adapters)
+            base = zapi.getService(None, self.serviceType)
         LocalAdapterRegistry.__init__(self, base)
 
     def registrations(self):




More information about the Zope3-Checkins mailing list