From be482ea6bc3da0467de655180f24b7fe83928b5a Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 1 Mar 2023 13:46:20 -0500 Subject: [PATCH] Don't attempt to gather the augmented methods if no task is provided -- if we aren't working within the context of a task, we are not working in a context where augmented methods can work (at least not all of them). This was causing an error when attepting to use the custom engine to execute extraction expressions on messages. --- .../spiffworkflow_backend/config/permissions/example.yml | 6 ++++++ .../services/process_instance_processor.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/example.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/example.yml index 77d87ca8d..261625101 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/example.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/example.yml @@ -30,6 +30,12 @@ groups: admin@spiffworkflow.org, nelson@spiffworkflow.org ] + approvers: + users: + [ + malala@spiffworkflow.org, + oskar@spiffworkflow.org + ] permissions: # Admins have access to everything. diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index 71055d9ab..bed827cb3 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -350,7 +350,9 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore external_methods: Optional[Dict[str, Any]] = None, ) -> Any: """_evaluate.""" - methods = self.__get_augment_methods(task) + methods = {} + if task: + methods = self.__get_augment_methods(task) if external_methods: methods.update(external_methods)