From: W. Trevor King Date: Fri, 22 Mar 2013 15:27:45 +0000 (-0400) Subject: ui.cli: Don't record EOF or blank entries as answers X-Git-Tag: v0.4~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fd8fca63111b2cc6d55d90322da4be2d773ec542;p=quizzer.git ui.cli: Don't record EOF or blank entries as answers If the user closes stdin, don't check and see if 'EOF' is an allowed answer, just exit the QuestionCommandLine loop. Don't try to process blank entries either, just re-ask the question. --- diff --git a/quizzer/ui/cli.py b/quizzer/ui/cli.py index cbfa16d..14ae67f 100644 --- a/quizzer/ui/cli.py +++ b/quizzer/ui/cli.py @@ -122,6 +122,10 @@ class QuestionCommandLine (_cmd.Cmd): answer = self.answers[0] else: answer = '' + if answer == 'EOF': + return True # quit + if answer == '': + return kwargs = {} if self._tempdir: kwargs['tempdir'] = self._tempdir