From 8b47b301e4d646f881c00cb64fe5f65e705f1fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 27 Jul 2018 13:59:14 +0200 Subject: [PATCH] Use jinja2 in default YamlFSM --- solvable/src/event_handler_main.py | 6 +++++- solvable/src/test_fsm.yml | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index 1d09f7a..a3639e2 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -103,7 +103,11 @@ if __name__ == '__main__': # TFW component EventHandlers (builtins, required for their respective functionalities) fsm = FSMManagingEventHandler( # TFW FSM key='fsm', - fsm_type=partial(YamlFSM, 'test_fsm.yml') + fsm_type=partial( + YamlFSM, + 'test_fsm.yml', + {} # jinja2 variables, use empty dict to enable jinja2 parsing without any variables + ) ) ide = IdeEventHandler( # Web IDE backend key='ide', diff --git a/solvable/src/test_fsm.yml b/solvable/src/test_fsm.yml index b195479..d34ebcb 100644 --- a/solvable/src/test_fsm.yml +++ b/solvable/src/test_fsm.yml @@ -41,3 +41,8 @@ transitions: - trigger: step_5 source: '4' dest: '5' + {% for i in range(5) %} # you can also use jinja2 in this config file + - trigger: 'step_next' + source: '{{i}}' + dest: '{{i+1}}' + {% endfor %}