Author: adrian
Date: 2009-04-10 13:58:32 -0500 (Fri, 10 Apr 2009)
New Revision: 10497

Modified:
   django/trunk/django/dispatch/dispatcher.py
   django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py
Log:
Fixed #10753 -- Fixed regression in dispatcher after [10398]. Thanks for the 
patch and tests, minmax

Modified: django/trunk/django/dispatch/dispatcher.py
===================================================================
--- django/trunk/django/dispatch/dispatcher.py  2009-04-10 18:45:06 UTC (rev 
10496)
+++ django/trunk/django/dispatch/dispatcher.py  2009-04-10 18:58:32 UTC (rev 
10497)
@@ -124,6 +124,7 @@
             (r_key, _) = self.receivers[index]
             if r_key == lookup_key:
                 del self.receivers[index]
+                break
 
     def send(self, sender, **named):
         """Send signal from sender to all connected receivers.

Modified: django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py
===================================================================
--- django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py        
2009-04-10 18:45:06 UTC (rev 10496)
+++ django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py        
2009-04-10 18:58:32 UTC (rev 10497)
@@ -103,6 +103,19 @@
         a_signal.disconnect(fails)
         self._testIsClean(a_signal)
 
+    def testDisconnection(self):
+        receiver_1 = Callable()
+        receiver_2 = Callable()
+        receiver_3 = Callable()
+        a_signal.connect(receiver_1)
+        a_signal.connect(receiver_2)
+        a_signal.connect(receiver_3)
+        a_signal.disconnect(receiver_1)
+        del receiver_2
+        garbage_collect()
+        a_signal.disconnect(receiver_3)
+        self._testIsClean(a_signal)
+
 def getSuite():
     return unittest.makeSuite(DispatcherTests,'test')
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to