From fd8fca63111b2cc6d55d90322da4be2d773ec542 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 22 Mar 2013 11:27:45 -0400 Subject: [PATCH] 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. --- quizzer/ui/cli.py | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.26.2