[Zope3-checkins] CVS: Zope3/src/zope/app/services - event.py:1.20

Steve Alexander steve@cat-box.net
Sun, 16 Mar 2003 10:44:36 -0500


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

Modified Files:
	event.py 
Log Message:
Reinstated the code that removes bad subscribers from an event channel's
subscriptions, along with a unit test for this code path.

This is the code Guido commented out, as it was broken, with no unit test.
  http://mail.zope.org/pipermail/zope3-checkins/2003-March/006968.html



=== Zope3/src/zope/app/services/event.py 1.19 => 1.20 ===
--- Zope3/src/zope/app/services/event.py:1.19	Wed Mar 12 14:22:36 2003
+++ Zope3/src/zope/app/services/event.py	Sun Mar 16 10:44:05 2003
@@ -112,11 +112,12 @@
                 # adding this subscriber to badSubscribers is inappropriate.
                 getAdapter(obj, ISubscriber).notify(event)
 
-##        # XXX This code is bogus: unsubscribe() takes two arguments, not one.
-##        #     Alas, I don't know how to fix it; I just don't want it to fail.
-##        for subscriber in badSubscribers:
-##            # XXX this ought to be logged
-##            clean_self.unsubscribe(subscriber)
+        for subscriber in badSubscribers:
+            # XXX this ought to be logged
+            # Also, is it right that we should sometimes have
+            # "write caused by a read" semantics? I'm seeing notify() as
+            # basically a read, and (un)subscribe as a write.
+            wrapped_self.unsubscribeAll(subscriber)
 
     def notify(wrapped_self, event):
         clean_self = removeAllProxies(wrapped_self)