summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-07-29 13:34:08 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-07-29 13:34:08 -0300
commit2d9ce114daeaf6c4c193079b018576ad1f4f8f28 (patch)
tree93cbb70fe86c1ee14a88f5867a5a639fa188cbd7
parent2e911bd0c949b7f42824ed87c467b1ac0919224a (diff)
[bug] register and unregister controlled by flag
Since register and unregister cant be used without full zmq initialization, it should make sense to also check flag for them.
-rw-r--r--src/leap/common/events/client.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/leap/common/events/client.py b/src/leap/common/events/client.py
index 4790fc3..e085f5b 100644
--- a/src/leap/common/events/client.py
+++ b/src/leap/common/events/client.py
@@ -508,8 +508,9 @@ def register(event, callback, uid=None, replace=False):
:raises CallbackAlreadyRegisteredError: when there's already a callback
identified by the given uid and replace is False.
"""
- return EventsClientThread.instance().register(
- event, callback, uid=uid, replace=replace)
+ if flags.EVENTS_ENABLED:
+ return EventsClientThread.instance().register(
+ event, callback, uid=uid, replace=replace)
def unregister(event, uid=None):
@@ -524,7 +525,8 @@ def unregister(event, uid=None):
:param uid: The callback uid.
:type uid: str
"""
- return EventsClientThread.instance().unregister(event, uid=uid)
+ if flags.EVENTS_ENABLED:
+ return EventsClientThread.instance().unregister(event, uid=uid)
def emit(event, *content):