flows: fix error in inspector view
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
7327939684
commit
bab6f501ec
|
@ -87,9 +87,7 @@ class FlowInspectorView(APIView):
|
||||||
@extend_schema(
|
@extend_schema(
|
||||||
responses={
|
responses={
|
||||||
200: FlowInspectionSerializer(),
|
200: FlowInspectionSerializer(),
|
||||||
400: OpenApiResponse(
|
400: OpenApiResponse(description="No flow plan in session."),
|
||||||
description="No flow plan in session."
|
|
||||||
), # This error can be raised by the email stage
|
|
||||||
},
|
},
|
||||||
request=OpenApiTypes.NONE,
|
request=OpenApiTypes.NONE,
|
||||||
operation_id="flows_inspector_get",
|
operation_id="flows_inspector_get",
|
||||||
|
@ -106,7 +104,10 @@ class FlowInspectorView(APIView):
|
||||||
if SESSION_KEY_PLAN in request.session:
|
if SESSION_KEY_PLAN in request.session:
|
||||||
current_plan: FlowPlan = request.session[SESSION_KEY_PLAN]
|
current_plan: FlowPlan = request.session[SESSION_KEY_PLAN]
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
current_plan = request.session[SESSION_KEY_HISTORY][-1]
|
current_plan = request.session[SESSION_KEY_HISTORY][-1]
|
||||||
|
except KeyError:
|
||||||
|
return Response(status=400)
|
||||||
is_completed = True
|
is_completed = True
|
||||||
current_serializer = FlowInspectorPlanSerializer(
|
current_serializer = FlowInspectorPlanSerializer(
|
||||||
instance=current_plan, context={"request": request}
|
instance=current_plan, context={"request": request}
|
||||||
|
|
Reference in New Issue