summaryrefslogtreecommitdiff
path: root/django/dispatch
diff options
context:
space:
mode:
authorДилян Палаузов <Dilyan.Palauzov@db.com>2017-12-27 00:14:12 +0530
committerTim Graham <timograham@gmail.com>2017-12-26 17:11:15 -0500
commit4c599ece57fa009cf3615f09497f81bfa6a585a7 (patch)
tree1f27a7e76024aaa5bc69356826061262d35d0be3 /django/dispatch
parentc21f158295d92e35caf96436bfdbbff554fc5569 (diff)
downloaddjango-4c599ece57fa009cf3615f09497f81bfa6a585a7.tar.gz
Fixed #28930 -- Simplified code with any() and all().
Diffstat (limited to 'django/dispatch')
-rw-r--r--django/dispatch/dispatcher.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py
index 5e1f83890f..6488c7fbd4 100644
--- a/django/dispatch/dispatcher.py
+++ b/django/dispatch/dispatcher.py
@@ -106,10 +106,7 @@ class Signal:
with self.lock:
self._clear_dead_receivers()
- for r_key, _ in self.receivers:
- if r_key == lookup_key:
- break
- else:
+ if not any(r_key == lookup_key for r_key, _ in self.receivers):
self.receivers.append((lookup_key, receiver))
self.sender_receivers_cache.clear()