Remove backend references to Box (#579)
This commit is contained in:
parent
c18c5a8d9c
commit
36b7b2462e
|
@ -30,8 +30,7 @@ from SpiffWorkflow.bpmn.exceptions import WorkflowTaskException # type: ignore
|
||||||
from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore
|
from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore
|
||||||
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore
|
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore
|
||||||
from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BasePythonScriptEngineEnvironment # type: ignore
|
from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BasePythonScriptEngineEnvironment # type: ignore
|
||||||
from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box
|
from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment
|
||||||
from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BoxedTaskDataEnvironment
|
|
||||||
from SpiffWorkflow.bpmn.serializer.default.task_spec import EventConverter # type: ignore
|
from SpiffWorkflow.bpmn.serializer.default.task_spec import EventConverter # type: ignore
|
||||||
from SpiffWorkflow.bpmn.serializer.helpers.registry import DefaultRegistry # type: ignore
|
from SpiffWorkflow.bpmn.serializer.helpers.registry import DefaultRegistry # type: ignore
|
||||||
from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer # type: ignore
|
from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer # type: ignore
|
||||||
|
@ -139,7 +138,7 @@ class MissingProcessInfoError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BoxedTaskDataBasedScriptEngineEnvironment(BoxedTaskDataEnvironment): # type: ignore
|
class TaskDataBasedScriptEngineEnvironment(TaskDataEnvironment): # type: ignore
|
||||||
def __init__(self, environment_globals: dict[str, Any]):
|
def __init__(self, environment_globals: dict[str, Any]):
|
||||||
self._last_result: dict[str, Any] = {}
|
self._last_result: dict[str, Any] = {}
|
||||||
super().__init__(environment_globals)
|
super().__init__(environment_globals)
|
||||||
|
@ -190,8 +189,6 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment)
|
||||||
context: dict[str, Any],
|
context: dict[str, Any],
|
||||||
external_methods: dict[str, Any] | None = None,
|
external_methods: dict[str, Any] | None = None,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
# TODO: once integrated look at the tests that fail without Box
|
|
||||||
Box.convert_to_box(context)
|
|
||||||
state = {}
|
state = {}
|
||||||
state.update(self.globals)
|
state.update(self.globals)
|
||||||
state.update(external_methods or {})
|
state.update(external_methods or {})
|
||||||
|
@ -205,9 +202,6 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment)
|
||||||
context: dict[str, Any],
|
context: dict[str, Any],
|
||||||
external_methods: dict[str, Any] | None = None,
|
external_methods: dict[str, Any] | None = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
# TODO: once integrated look at the tests that fail without Box
|
|
||||||
# context is task.data
|
|
||||||
Box.convert_to_box(context)
|
|
||||||
self.state.update(self.globals)
|
self.state.update(self.globals)
|
||||||
self.state.update(external_methods or {})
|
self.state.update(external_methods or {})
|
||||||
self.state.update(context)
|
self.state.update(context)
|
||||||
|
@ -268,12 +262,7 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment)
|
||||||
self.state[result_variable] = task.data.pop(result_variable)
|
self.state[result_variable] = task.data.pop(result_variable)
|
||||||
|
|
||||||
|
|
||||||
# SpiffWorkflow at revision f162aac43af3af18d1a55186aeccea154fb8b05d runs script tasks on ready
|
class CustomScriptEngineEnvironment(TaskDataBasedScriptEngineEnvironment):
|
||||||
# which means that our will_complete_task hook does not have the correct env state when it runs
|
|
||||||
# so save everything to task data for now until we can figure out a better way to hook into that.
|
|
||||||
# Revision 6cad2981712bb61eca23af1adfafce02d3277cb9 is the last revision that can run with this.
|
|
||||||
# class CustomScriptEngineEnvironment(NonTaskDataBasedScriptEngineEnvironment):
|
|
||||||
class CustomScriptEngineEnvironment(BoxedTaskDataBasedScriptEngineEnvironment):
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,7 +334,7 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore
|
||||||
def _evaluate(
|
def _evaluate(
|
||||||
self,
|
self,
|
||||||
expression: str,
|
expression: str,
|
||||||
context: dict[str, Box | str],
|
context: dict[str, Any],
|
||||||
task: SpiffTask | None = None,
|
task: SpiffTask | None = None,
|
||||||
external_methods: dict[str, Any] | None = None,
|
external_methods: dict[str, Any] | None = None,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
<bpmn:message id="message_response_one" name="Message Response One">
|
<bpmn:message id="message_response_one" name="Message Response One">
|
||||||
<bpmn:extensionElements>
|
<bpmn:extensionElements>
|
||||||
<spiffworkflow:messagePayload>{
|
<spiffworkflow:messagePayload>{
|
||||||
"topica_one": payload_var_one.topica_one,
|
"topica_one": payload_var_one["topica_one"],
|
||||||
"topicb_one": payload_var_one.topicb_one,
|
"topicb_one": payload_var_one["topicb_one"],
|
||||||
"second_var_one": second_var_one
|
"second_var_one": second_var_one
|
||||||
}</spiffworkflow:messagePayload>
|
}</spiffworkflow:messagePayload>
|
||||||
</bpmn:extensionElements>
|
</bpmn:extensionElements>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<bpmn:scriptTask id="add_numbers" name="Add Numbers" scriptFormat="python">
|
<bpmn:scriptTask id="add_numbers" name="Add Numbers" scriptFormat="python">
|
||||||
<bpmn:incoming>Flow_0rx0bxv</bpmn:incoming>
|
<bpmn:incoming>Flow_0rx0bxv</bpmn:incoming>
|
||||||
<bpmn:outgoing>Flow_197lbl3</bpmn:outgoing>
|
<bpmn:outgoing>Flow_197lbl3</bpmn:outgoing>
|
||||||
<bpmn:script>second_var_one = payload_var_one.initial_var_one + 1</bpmn:script>
|
<bpmn:script>second_var_one = payload_var_one["initial_var_one"] + 1</bpmn:script>
|
||||||
</bpmn:scriptTask>
|
</bpmn:scriptTask>
|
||||||
<bpmn:startEvent id="receive_message" name="Receive Message">
|
<bpmn:startEvent id="receive_message" name="Receive Message">
|
||||||
<bpmn:outgoing>Flow_0rx0bxv</bpmn:outgoing>
|
<bpmn:outgoing>Flow_0rx0bxv</bpmn:outgoing>
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
<bpmn:message id="message_response_two" name="Message Response Two">
|
<bpmn:message id="message_response_two" name="Message Response Two">
|
||||||
<bpmn:extensionElements>
|
<bpmn:extensionElements>
|
||||||
<spiffworkflow:messagePayload>{
|
<spiffworkflow:messagePayload>{
|
||||||
"topic_two_a": payload_var_two.topica_two,
|
"topic_two_a": payload_var_two["topica_two"],
|
||||||
"topic_two_b": payload_var_two.topicb_two,
|
"topic_two_b": payload_var_two["topicb_two"],
|
||||||
"second_var_two": second_var_two
|
"second_var_two": second_var_two
|
||||||
}</spiffworkflow:messagePayload>
|
}</spiffworkflow:messagePayload>
|
||||||
</bpmn:extensionElements>
|
</bpmn:extensionElements>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<bpmn:scriptTask id="add_numbers" name="Add Numbers" scriptFormat="python">
|
<bpmn:scriptTask id="add_numbers" name="Add Numbers" scriptFormat="python">
|
||||||
<bpmn:incoming>Flow_0rx0bxv</bpmn:incoming>
|
<bpmn:incoming>Flow_0rx0bxv</bpmn:incoming>
|
||||||
<bpmn:outgoing>Flow_197lbl3</bpmn:outgoing>
|
<bpmn:outgoing>Flow_197lbl3</bpmn:outgoing>
|
||||||
<bpmn:script>second_var_two = payload_var_two.initial_var_two + 1</bpmn:script>
|
<bpmn:script>second_var_two = payload_var_two["initial_var_two"] + 1</bpmn:script>
|
||||||
</bpmn:scriptTask>
|
</bpmn:scriptTask>
|
||||||
<bpmn:startEvent id="receive_message" name="Receive Message">
|
<bpmn:startEvent id="receive_message" name="Receive Message">
|
||||||
<bpmn:outgoing>Flow_0rx0bxv</bpmn:outgoing>
|
<bpmn:outgoing>Flow_0rx0bxv</bpmn:outgoing>
|
||||||
|
|
Loading…
Reference in New Issue