Commit fea1d3e8 by Xavier Antoviaque

Add instructions to add custom scenarios & don't fail when none exist

parent c6dca82b
...@@ -128,6 +128,17 @@ INSTALLED_APPS += ('mentoring',) ...@@ -128,6 +128,17 @@ INSTALLED_APPS += ('mentoring',)
DATABASES['default']['NAME'] = 'workbench.sqlite' DATABASES['default']['NAME'] = 'workbench.sqlite'
``` ```
Adding custom scenarios in the workbench
----------------------------------------
Create the `templates/xml` and add XML scenarios to it - all files with the `*.xml` extension will be
automatically loaded by the workbench:
```bash
$ mkdir templates/xml
$ cat > templates/xml/my_mentoring_scenario.xml
```
Starting the workbench Starting the workbench
---------------------- ----------------------
......
...@@ -76,16 +76,17 @@ def get_scenarios_from_path(scenarios_path, include_identifier=False): ...@@ -76,16 +76,17 @@ def get_scenarios_from_path(scenarios_path, include_identifier=False):
scenarios_fullpath = os.path.join(base_fullpath, scenarios_path) scenarios_fullpath = os.path.join(base_fullpath, scenarios_path)
scenarios = [] scenarios = []
for template in os.listdir(scenarios_fullpath): if os.path.isdir(scenarios_fullpath):
if not template.endswith('.xml'): for template in os.listdir(scenarios_fullpath):
continue if not template.endswith('.xml'):
identifier = template[:-4] continue
title = identifier.replace('_', ' ').title() identifier = template[:-4]
template_path = os.path.join(scenarios_path, template) title = identifier.replace('_', ' ').title()
if not include_identifier: template_path = os.path.join(scenarios_path, template)
scenarios.append((title, load_resource(template_path))) if not include_identifier:
else: scenarios.append((title, load_resource(template_path)))
scenarios.append((identifier, title, load_resource(template_path))) else:
scenarios.append((identifier, title, load_resource(template_path)))
return scenarios return scenarios
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment