diff --git a/pyproject.toml b/pyproject.toml index 375b937..8322890 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ where = ["src"] [project] name = "bazario" -version = "0.3.0" +version = "0.4.0" readme = "README.md" authors = [{ name = "Alim Abrekov", email = "chessinmind17@yandex.ru" }] description = "Lightweight handler routing library for modular apps." diff --git a/src/bazario/asyncio/registry.py b/src/bazario/asyncio/registry.py index 66a9dea..dcf5ddd 100644 --- a/src/bazario/asyncio/registry.py +++ b/src/bazario/asyncio/registry.py @@ -51,7 +51,12 @@ def get_notification_handlers( self, notification_type: type[Notification], ) -> list[type[NotificationHandler]]: - return self.notification_handlers.get(notification_type, []) + return [ + handler + for notification, handlers in self.notification_handlers.items() + for handler in handlers + if issubclass(notification_type, notification) + ] def get_pipeline_behaviors( self, diff --git a/src/bazario/registry.py b/src/bazario/registry.py index ec6536e..0a22226 100644 --- a/src/bazario/registry.py +++ b/src/bazario/registry.py @@ -51,7 +51,12 @@ def get_notification_handlers( self, notification_type: type[Notification], ) -> list[type[NotificationHandler]]: - return self.notification_handlers.get(notification_type, []) + return [ + handler + for notification, handlers in self.notification_handlers.items() + for handler in handlers + if issubclass(notification_type, notification) + ] def get_pipeline_behaviors( self,