diff --git a/lib/tfw/event_handler_base.py b/lib/tfw/event_handler_base.py index 6f9819b..beb79a4 100644 --- a/lib/tfw/event_handler_base.py +++ b/lib/tfw/event_handler_base.py @@ -3,6 +3,7 @@ from abc import ABC, abstractmethod from inspect import currentframe +from typing import Iterable from tfw.networking.event_handlers import ServerConnector from tfw.crypto import message_checksum, KeyManager, verify_message @@ -20,7 +21,12 @@ class EventHandlerBase(ABC): """ def __init__(self, key): self.server_connector = ServerConnector() - self.keys = [key] + self.keys = [] + if isinstance(key, str): + self.keys.append(key) + elif isinstance(key, Iterable): + self.keys = list(key) + self.subscribe(*self.keys) self.server_connector.register_callback(self.event_handler_callback)