aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow/views.py
diff options
context:
space:
mode:
authorSawyer Bergeron <sawyerbergeron@gmail.com>2018-12-14 16:05:47 -0500
committerSawyer Bergeron <sawyerbergeron@gmail.com>2019-01-03 10:34:13 -0500
commitf27e25c199c3c5c9433463732b776ae9b4357cf8 (patch)
treed684ed4b89355db5050021b4aaaf505d4de70bc8 /src/workflow/views.py
parente26a8259dbe879d722d5e619f9d6efe0b113d1cd (diff)
Implement Segmented Workflows
A major source of bugs has been how we've approached inlining workflows. We no longer inline them as of this commit, and instead use a stack structure. This commits the result of workflows to the database before other workflows try to read them, so we don't have to maintain a code path for when something is or isn't committed to db. This patchset allows for workflows to pass limited information to preset selections Change-Id: I3d040c7f3024c7420017ae4ec66a23219303dcb6 Signed-off-by: Sawyer Bergeron <sawyerbergeron@gmail.com>
Diffstat (limited to 'src/workflow/views.py')
-rw-r--r--src/workflow/views.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/workflow/views.py b/src/workflow/views.py
index e5ef5c6..6d59b1c 100644
--- a/src/workflow/views.py
+++ b/src/workflow/views.py
@@ -30,6 +30,17 @@ def attempt_auth(request):
def delete_session(request):
+ manager = attempt_auth(request)
+
+ if not manager:
+ return HttpResponseGone("No session found that relates to current request")
+
+ if manager.pop_workflow():
+ return HttpResponse('')
+ else:
+ del ManagerTracker.managers[request.session['manager_session']]
+ return render(request, 'workflow/exit_redirect.html')
+
try:
del ManagerTracker.managers[request.session['manager_session']]
return HttpResponse('')
@@ -70,7 +81,8 @@ def manager_view(request):
logger.debug("edit found")
manager.add_workflow(workflow_type=request.POST.get('edit'), edit_object=int(request.POST.get('edit_id')))
elif request.POST.get('cancel') is not None:
- del ManagerTracker.managers[request.session['manager_session']]
+ if not manager.pop_workflow():
+ del ManagerTracker.managers[request.session['manager_session']]
return manager.status(request)