[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/interface/adapter.py Fixed unsubscribe bug.

Jim Fulton jim at zope.com
Mon Feb 20 16:54:16 EST 2006


Log message for revision 41718:
  Fixed unsubscribe bug.
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/interface/adapter.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/interface/adapter.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/interface/adapter.py	2006-02-20 21:54:14 UTC (rev 41717)
+++ Zope3/branches/jim-adapter/src/zope/interface/adapter.py	2006-02-20 21:54:16 UTC (rev 41718)
@@ -169,7 +169,7 @@
         old = components.get(name)
         if old is None:
             return
-        if value is not None and old != value:
+        if (value is not None) and (old != value):
             return
 
         del components[name]
@@ -178,6 +178,8 @@
             del self._provided[provided]
             if '_v_extendors' in self.__dict__:
                 del self.__dict__['_v_extendors']
+        else:
+            self._provided[provided] = n
 
         self.changed()
 
@@ -211,7 +213,7 @@
 
         self.changed()
 
-    def unsubscribe(self, required, provided, value):
+    def unsubscribe(self, required, provided, value=None):
         required = tuple(map(_convert_None_to_Interface, required))
         order = len(required)
         byorder = self._subscribers
@@ -228,7 +230,7 @@
 
         components[u''] = tuple([
             v for v in components.get(u'', ())
-            if v != value
+            if (v != value) or (value is None)
             ])
 
         if provided is not None:



More information about the Zope3-Checkins mailing list