Flow InheritanceΒΆ

Flow inheritance allows to override and add additional transitions to a new class.

To keep same state changes but with additional code, use State.super() decorator. To get access to undecorated base method use .original attribute

class MyFlow(object):
    state = fsm.State(Stage, default=Stage.NEW)

    @state.transition(source=Stage.DONE, target=Stage.HIDDEN)
    def hide():
        print('base hide')

class GuestFlow(MyFlow):
    @MyFlow.state.super()
    def hide(self):
        # any additional code here
        super().hide.original()