bouncing to fix a bug in SpiffWorkflow that was holding outo outdated data deed within the python_script_engine.

This caused validation to fail for valid repeat sections, so including a fix to allow that validation to continue.
This commit is contained in:
Dan 2021-08-11 14:21:23 -04:00
parent fd468f1013
commit 318cd34f81
2 changed files with 8 additions and 1 deletions

2
Pipfile.lock generated
View File

@ -979,7 +979,7 @@
},
"spiffworkflow": {
"git": "https://github.com/sartography/SpiffWorkflow.git",
"ref": "1df28b940ec0d32b672e59e3d17e7a804cb2b186"
"ref": "e266745f6ff74995f125dd3821eab36cfe745a54"
},
"sqlalchemy": {
"hashes": [

View File

@ -1,3 +1,4 @@
import copy
import string
from datetime import datetime
import random
@ -328,7 +329,13 @@ class WorkflowService(object):
# Then you must evaluate the expression based on the data within the group only.
group = field.get_property(Task.FIELD_PROP_REPEAT)
if group in task.data:
# Here we must make the current group data top level (as it would be in a repeat section) but
# make all other top level task data available as well.
new_data = copy.deepcopy(task.data)
del(new_data[group])
data = task.data[group][0]
data.update(new_data)
try:
return task.workflow.script_engine.eval(expression, data)
except Exception as e: