black + isort + Added ChangeLog

This commit is contained in:
Вадим Христенко 2025-04-14 20:34:30 +00:00
parent 729a17903e
commit b4a12a60bf
2 changed files with 6 additions and 4 deletions

2
CHANGES/<>.bugfix.rst Normal file
View file

@ -0,0 +1,2 @@
- Scene action handlers (such as `enter`, `leave`, etc.) now properly receive context and data from observer (`outer_middleware`) middlewares, matching the behavior of regular handlers.
- Fixed `TypeError` when accessing middleware-injected arguments inside scene handlers.

View file

@ -556,7 +556,9 @@ class SceneWizard:
if not self.scene:
raise SceneException("Scene is not initialized")
loggers.scene.debug("Call action %r in scene %r (middleware aware)", action.name, self.scene_config.state)
loggers.scene.debug(
"Call action %r in scene %r (middleware aware)", action.name, self.scene_config.state
)
action_config = self.scene_config.actions.get(action, {})
if not action_config:
loggers.scene.debug(
@ -588,9 +590,7 @@ class SceneWizard:
return await action_config[event_type].call(self.scene, event, **data)
await observer.wrap_outer_middleware(
_actual_handler,
event=self.event,
data={**self.data, **kwargs}
_actual_handler, event=self.event, data={**self.data, **kwargs}
)
return True