summaryrefslogtreecommitdiff
path: root/django/dispatch
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2012-09-20 03:18:19 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2012-09-28 18:10:52 +0300
commit3fcca0e94721a734882389ce473f522d293907e9 (patch)
treefc6c2601bda421c79da5cf38c45c96df09d38a83 /django/dispatch
parent07ffe7814394815d116cdbe814ec6a523b345df1 (diff)
downloaddjango-3fcca0e94721a734882389ce473f522d293907e9.tar.gz
Added a way to check if a signal has listeners
Diffstat (limited to 'django/dispatch')
-rw-r--r--django/dispatch/dispatcher.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py
index ad7302176e..8d26e58bf4 100644
--- a/django/dispatch/dispatcher.py
+++ b/django/dispatch/dispatcher.py
@@ -141,6 +141,9 @@ class Signal(object):
del self.receivers[index]
break
+ def has_listeners(self, sender=None):
+ return bool(self._live_receivers(_make_id(sender)))
+
def send(self, sender, **named):
"""
Send signal from sender to all connected receivers.