You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/actions.md
+20-16Lines changed: 20 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,8 +44,6 @@ For each event, you can register `before_<event>` and `after_<event>`
44
44
-`after_<event>(event_data)`
45
45
46
46
47
-
(validators-and-guards)=
48
-
49
47
## Other callbacks
50
48
51
49
In addition to {ref}`actions`, you can specify {ref}`validators-and-guards` that are checked
@@ -60,27 +58,32 @@ See {ref}`guards` and {ref}`validators`.
60
58
61
59
Actions and Guards will be executed in the following order:
62
60
63
-
-`validators(event_data)` (attached to the transition)
61
+
-`validators()` (attached to the transition)
64
62
65
-
-`conditions(event_data)` (attached to the transition)
63
+
-`conditions()` (attached to the transition)
66
64
67
-
-`unless(event_data)` (attached to the transition)
65
+
-`unless()` (attached to the transition)
68
66
69
-
-`before_transition(event_data)`
67
+
-`before_transition()`
70
68
71
-
-`before_<event>(event_data)`
69
+
-`before_<event>()`
72
70
73
-
-`on_exit_state(event_data)`
71
+
-`on_exit_state()`
74
72
75
-
-`on_exit_<state_identifier>(event_data)`
73
+
-`on_exit_<state_identifier>()`
76
74
77
-
-`on_enter_state(event_data)`
75
+
-`on_transition()`
78
76
79
-
-`on_enter_<state_identifier>(event_data)`
77
+
-`on_<event>()`
80
78
81
-
-`after_<event>(event_data)`
79
+
-`on_enter_state()`
80
+
81
+
-`on_enter_<state_identifier>()`
82
+
83
+
-`after_<event>()`
84
+
85
+
-`after_transition()`
82
86
83
-
-`after_transition(event_data)`
84
87
85
88
86
89
(dynamic-dispatch)=
@@ -90,8 +93,8 @@ python-statemachine implements a custom dispatch mechanism on all those availabl
90
93
Guards, this means that you can declare an arbitrary number of `*args` and `**kwargs`, and the
91
94
library will match your method signature of what's expect to receive with the provided arguments.
92
95
93
-
This means that if on your `on_enter_<state>()` or `on_execute_<event>()` method, you also
94
-
need to know the `source` ({ref}`state`), or the `event` ({ref}`event`), or access a keyword
96
+
This means that if on your `on_enter_<state>()` or `on_execute_<event>()` method, you need to know
97
+
the `source` ({ref}`state`), or the `event` ({ref}`event`), or access a keyword
95
98
argument passed with the trigger, just add this parameter to the method and It will be passed
96
99
by the dispatch mechanics.
97
100
@@ -116,7 +119,8 @@ For your convenience, all these parameters are available for you on any Action o
116
119
117
120
-`transition`: The {ref}`Transition` instance that was activated by the {ref}`Event`.
118
121
119
-
So, you can implement Actions and Guards like these, but this list is not exaustive, it's only to give you a few examples... any combination of parameters will work, including extra parameters
122
+
So, you can implement Actions and Guards like these, but this list is not exaustive, it's only
123
+
to give you a few examples... any combination of parameters will work, including extra parameters
120
124
that you may inform when triggering an {ref}`event`:
0 commit comments