From: W. Trevor King Date: Wed, 6 Feb 2013 21:13:10 +0000 (-0500) Subject: ui.cli: Fix single-line answer extraction X-Git-Tag: v0.1~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=73038c188e118332da0059fa650e69204d5faee2;p=quizzer.git 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. --- 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')