Added delete_files argument to the workflow_processor reset method.
Added code to delete the files when delete_files is True.
This commit is contained in:
parent
3332b9c7c0
commit
91e80d01bc
|
@ -174,7 +174,7 @@ class WorkflowProcessor(object):
|
|||
self.is_latest_spec = False
|
||||
|
||||
@staticmethod
|
||||
def reset(workflow_model, clear_data=False):
|
||||
def reset(workflow_model, clear_data=False, delete_files=False):
|
||||
print('WorkflowProcessor: reset: ')
|
||||
|
||||
# Try to execute a cancel notify
|
||||
|
@ -194,6 +194,10 @@ class WorkflowProcessor(object):
|
|||
for task_event in task_events:
|
||||
task_event.form_data = {}
|
||||
session.add(task_event)
|
||||
if delete_files:
|
||||
files = FileModel.query.filter(FileModel.workflow_id == workflow_model.id).all()
|
||||
for file in files:
|
||||
FileService.delete_file(file.id)
|
||||
session.commit()
|
||||
return WorkflowProcessor(workflow_model)
|
||||
|
||||
|
|
Loading…
Reference in New Issue