Open vtexier opened 12 months ago
I am able to reproduce the problem with this simple code.
The problem is in the Box
class. It overrides standard dict methods with dict keys.
from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box
# create a standard dict
d = {"items": [1,2], "toto": 'titi'}
# create a Box dict
b = Box(d)
# iterate items() on standard dict is OK
d.items()
# iterate items() on Box dict is NOT OK
b.items()
Box
is deprecated, but the deprecation message does not mention the new class to use...
Can you tell me what class to use in replacement of Box
?
I want to test this code with the new class replacing Box
to see if the problem persist.
Thanks for the update, we have been internally debating on Box
for a bit. Hopefully the diff that replaces Box is all red lines. I do appreciate following up on this, will add more points to our discussion.
Also forgot to address the replacement for Box
- at least within arena is based on this line - https://github.com/sartography/spiff-arena/blob/main/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py#L264
You'd want to switch it to NonTaskDataBasedScriptEngineEnvironment
as the base class, but this hasn't been tested in a while and looks like it may lead to issues based on the comment above.
I have opened https://github.com/sartography/SpiffWorkflow/issues/359 in the SpiffWorkflow library to remove Box
.
I created a Spiff Connector to a service returning a dict with the key "items" in it. The corresponding value of the key is a
list
.This key cause a TypeError on the next talk in the process in the diagram. Here in the code:
https://github.com/sartography/spiff-arena/blob/8c7061b0402be1bc4b23e9d820c58b85356413c2/SpiffWorkflow/SpiffWorkflow/bpmn/serializer/helpers/registry.py#L49C1-L49C55
task.data
is treated as an object (calledobj
in the code) and whenobj.items()
is called Python try to call the list value as a function.Here is the full exception of the event on the next task: