From 73038c188e118332da0059fa650e69204d5faee2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 6 Feb 2013 16:13:10 -0500 Subject: [PATCH] ui.cli: Fix single-line answer extraction `var.get(key, default)` only works for dicts. I don't think there is an equivalent that works for lists. --- quizzer/ui/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quizzer/ui/cli.py b/quizzer/ui/cli.py index fbebf4f..1cf01b1 100644 --- a/quizzer/ui/cli.py +++ b/quizzer/ui/cli.py @@ -66,8 +66,10 @@ class QuestionCommandLine (_cmd.Cmd): def _answer(self): if self.question.multiline: answer = self.answers + elif self.answers: + answer = self.answers[0] else: - answer = self.answers.get(0, '') + answer = '' correct = self.ui.process_answer(question=self.question, answer=answer) if correct: print('correct\n') -- 2.26.2