From 29db4a554996089309b743acbafa97123c3019fa Mon Sep 17 00:00:00 2001 From: Hendrik Buschmeier <hbuschme@uni-bielefeld.de> Date: Mon, 26 Jan 2015 17:00:15 +0100 Subject: [PATCH] ipaaca-python: warn if handler function is registered more than once. --- ipaacalib/python/src/ipaaca/buffer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ipaacalib/python/src/ipaaca/buffer.py b/ipaacalib/python/src/ipaaca/buffer.py index 7283039..cf9d3a8 100644 --- a/ipaacalib/python/src/ipaaca/buffer.py +++ b/ipaacalib/python/src/ipaaca/buffer.py @@ -155,6 +155,8 @@ class Buffer(object): for_categories -- a list of category names or None if handler should be called for all categories """ + if handler_function in [h._handler_function for h in self._iu_event_handlers]: + LOGGER.warn("The handler function '" + handler_function.__name__ + '" has been registered before.') handler = IUEventHandler(handler_function=handler_function, for_event_types=for_event_types, for_categories=for_categories) self._iu_event_handlers.append(handler) return handler -- GitLab