flows: handle error if flow title contains invalid format string

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-01-10 19:49:27 +01:00
parent 71dffb21a9
commit 19d5902a92
1 changed files with 6 additions and 3 deletions

View File

@ -118,9 +118,12 @@ class ChallengeStageView(StageView):
"""Allow usage of placeholder in flow title.""" """Allow usage of placeholder in flow title."""
if not self.executor.plan: if not self.executor.plan:
return self.executor.flow.title return self.executor.flow.title
try:
return self.executor.flow.title % { return self.executor.flow.title % {
"app": self.executor.plan.context.get(PLAN_CONTEXT_APPLICATION, "") "app": self.executor.plan.context.get(PLAN_CONTEXT_APPLICATION, "")
} }
except ValueError:
return self.executor.flow.title
def _get_challenge(self, *args, **kwargs) -> Challenge: def _get_challenge(self, *args, **kwargs) -> Challenge:
with Hub.current.start_span( with Hub.current.start_span(