projects
/
quizzer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
29f2ea1
)
ui.cli: Fix single-line answer extraction
author
W. Trevor King
<wking@tremily.us>
Wed, 6 Feb 2013 21:13:10 +0000
(16:13 -0500)
committer
W. Trevor King
<wking@tremily.us>
Wed, 6 Feb 2013 21:13:10 +0000
(16:13 -0500)
`var.get(key, default)` only works for dicts. I don't think there is
an equivalent that works for lists.
quizzer/ui/cli.py
patch
|
blob
|
history
diff --git
a/quizzer/ui/cli.py
b/quizzer/ui/cli.py
index fbebf4fd412edf18addf704357c92e8acfa7139f..1cf01b1a3fb418eb29e7e9b129c7c0db50581515 100644
(file)
--- 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')