[Checkins] SVN: zope.component/trunk/src/zope/component/registry. Pass the factory into adapters.unsubscribe so that only the right

Ross Patterson me at rpatterson.net
Thu Jun 14 19:44:50 EDT 2007


Log message for revision 76703:
  Pass the factory into adapters.unsubscribe so that only the right
  factory is removed
  

Changed:
  U   zope.component/trunk/src/zope/component/registry.py
  U   zope.component/trunk/src/zope/component/registry.txt

-=-
Modified: zope.component/trunk/src/zope/component/registry.py
===================================================================
--- zope.component/trunk/src/zope/component/registry.py	2007-06-14 19:44:02 UTC (rev 76702)
+++ zope.component/trunk/src/zope/component/registry.py	2007-06-14 23:44:49 UTC (rev 76703)
@@ -277,7 +277,7 @@
 
 
         self._subscription_registrations[:] = new
-        self.adapters.unsubscribe(required, provided)
+        self.adapters.unsubscribe(required, provided, factory)
 
         zope.event.notify(interfaces.Unregistered(
             SubscriptionRegistration(self, required, provided, name,

Modified: zope.component/trunk/src/zope/component/registry.txt
===================================================================
--- zope.component/trunk/src/zope/component/registry.txt	2007-06-14 19:44:02 UTC (rev 76702)
+++ zope.component/trunk/src/zope/component/registry.txt	2007-06-14 23:44:49 UTC (rev 76703)
@@ -651,6 +651,12 @@
     SubscriptionRegistration(<Components comps>, [I1], IA2, u'', A1_2, '')
     True
 
+    >>> for s in components.subscribers((tests.U1(1), ), tests.IA2):
+    ...    print s
+    A1_12(U1(1))
+    A(U1(1),)
+    A(U1(1),)
+
     >>> for registration in sorted(
     ...     components.registeredSubscriptionAdapters()):
     ...     print registration.required
@@ -675,6 +681,10 @@
     SubscriptionRegistration(<Components comps>, [I1], IA2, u'', A, '')
     True
 
+    >>> for s in components.subscribers((tests.U1(1), ), tests.IA2):
+    ...    print s
+    A1_12(U1(1))
+
     >>> for registration in sorted(
     ...     components.registeredSubscriptionAdapters()):
     ...     print registration.required
@@ -707,6 +717,9 @@
     SubscriptionRegistration(<Components comps>, [I1], IA2, u'', None, '')
     True
 
+    >>> for s in components.subscribers((tests.U1(1), ), tests.IA2):
+    ...    print s
+
     >>> for registration in sorted(
     ...     components.registeredSubscriptionAdapters()):
     ...     print registration.factory



More information about the Checkins mailing list