trigger_next_transition method will call the create trigger of the next stage for machines in CREATED state

This commit is contained in:
Philip Kalinsky 2020-01-16 15:29:14 -05:00 committed by tomdds
parent 743a91d658
commit dfaea2d937

View File

@ -108,13 +108,17 @@ class PortfolioStateMachine(
# the create trigger for the next stage should be in the available
# triggers for the current state
triggers = self.machine.get_triggers(state_obj.name)
try:
create_trigger = list(
filter(
lambda trigger: trigger.startswith("create_"),
self.machine.get_triggers(self.state.name),
)
)[0]
if create_trigger:
except IndexError:
# are we done ?
pass
else:
self.trigger(create_trigger, **kwargs)
# @with_payload