aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow/workflow_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/workflow/workflow_manager.py')
-rw-r--r--src/workflow/workflow_manager.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/workflow/workflow_manager.py b/src/workflow/workflow_manager.py
index 525aa6f..80b8a67 100644
--- a/src/workflow/workflow_manager.py
+++ b/src/workflow/workflow_manager.py
@@ -64,15 +64,15 @@ class SessionManager():
)
def pop_workflow(self):
- if(len(self.workflows) <= 1):
- return False
-
- if self.workflows[-1].repository.el[self.workflows[-1].repository.HAS_RESULT]:
- key = self.workflows[-1].repository.el[self.workflows[-1].repository.RESULT_KEY]
- result = self.workflows[-1].repository.el[self.workflows[-1].repository.RESULT]
- self.workflows[-2].repository.el[key] = result
- self.workflows.pop()
- return True
+ multiple_wfs = len(self.workflows) > 1
+ if multiple_wfs:
+ if self.workflows[-1].repository.el[Repository.RESULT]: # move result
+ key = self.workflows[-1].repository.el[Repository.RESULT_KEY]
+ result = self.workflows[-1].repository.el[Repository.RESULT]
+ self.workflows[-2].repository.el[key] = result
+ self.workflows.pop()
+ current_repo = self.workflows[-1].repository
+ return (multiple_wfs, current_repo.el[current_repo.RESULT])
def status(self, request):
try:
@@ -97,7 +97,13 @@ class SessionManager():
def post_render(self, request):
return self.active_workflow().steps[self.active_workflow().active_index].post_render(request)
+ def get_active_step(self):
+ return self.active_workflow().steps[self.active_workflow().active_index]
+
def go_next(self, **kwargs):
+ # need to verify current step is valid to allow this
+ if self.get_active_step().valid < 200:
+ return
next_step = self.active_workflow().active_index + 1
if next_step >= len(self.active_workflow().steps):
raise Exception("Out of bounds request for step")