mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-11-04 09:22:56 +00:00 
			
		
		
		
	Use jinja2 in default YamlFSM
This commit is contained in:
		@@ -103,7 +103,11 @@ if __name__ == '__main__':
 | 
				
			|||||||
    # TFW component EventHandlers (builtins, required for their respective functionalities)
 | 
					    # TFW component EventHandlers (builtins, required for their respective functionalities)
 | 
				
			||||||
    fsm = FSMManagingEventHandler( # TFW FSM
 | 
					    fsm = FSMManagingEventHandler( # TFW FSM
 | 
				
			||||||
        key='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
 | 
					    ide = IdeEventHandler(  # Web IDE backend
 | 
				
			||||||
        key='ide',
 | 
					        key='ide',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,3 +41,8 @@ transitions:
 | 
				
			|||||||
    -   trigger: step_5
 | 
					    -   trigger: step_5
 | 
				
			||||||
        source: '4'
 | 
					        source: '4'
 | 
				
			||||||
        dest: '5'
 | 
					        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 %}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user