diff --git a/papers/events.py b/papers/events.py index 29771a6..6fd77e6 100644 --- a/papers/events.py +++ b/papers/events.py @@ -9,16 +9,16 @@ class Event(object): """ This function sends the instance of the class, i.e. the event to be sent, to all function that listen to it. """ - if self.__class__.__name__ in _listener: - for f, args in _listener[self.__class__.__name__]: + if self.__class__ in _listener: + for f, args in _listener[self.__class__]: f(self, *args) @classmethod def listen(cls, *args): def wrap(f): - if cls.__name__ not in _listener: - _listener[cls.__name__] = [] - _listener[cls.__name__].append((f, args)) + if cls not in _listener: + _listener[cls] = [] + _listener[cls].append((f, args)) # next step allow us to call the function itself without Event raised def wrapped_f(*args):