Added a field `handle` that displays the filename, which is what configurators actually call in a script task.
This commit is contained in:
parent
72349cacf5
commit
d7b7f39128
|
@ -1,6 +1,8 @@
|
|||
import hashlib
|
||||
import io
|
||||
import json
|
||||
import inspect
|
||||
import os
|
||||
|
||||
import connexion
|
||||
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine
|
||||
|
@ -58,11 +60,17 @@ def list_scripts():
|
|||
scripts = Script.get_all_subclasses()
|
||||
script_meta = []
|
||||
for script_class in scripts:
|
||||
script_meta.append(
|
||||
{
|
||||
"name": script_class.__name__,
|
||||
"description": script_class().get_description()
|
||||
})
|
||||
file_path = inspect.getfile(script_class)
|
||||
file_name = os.path.basename(file_path)
|
||||
# This grabs the filename without the suffix,
|
||||
# which is what configurators actually use in a script task.
|
||||
handle = os.path.splitext(file_name)[0]
|
||||
meta_data = {
|
||||
"name": script_class.__name__,
|
||||
"handle": handle,
|
||||
"description": script_class().get_description()
|
||||
}
|
||||
script_meta.append(meta_data)
|
||||
return script_meta
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue