From 18dd9e2b8ff0e21322ac4d0b66ec5d5aded3c193 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 12 Aug 2011 09:54:11 +0200 Subject: [PATCH] always flush formatter after calling a command --- weboob/tools/application/formatters/table.py | 3 +++ weboob/tools/application/repl.py | 23 +++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/weboob/tools/application/formatters/table.py b/weboob/tools/application/formatters/table.py index 88903612..86d59844 100644 --- a/weboob/tools/application/formatters/table.py +++ b/weboob/tools/application/formatters/table.py @@ -77,6 +77,9 @@ class TableFormatter(IFormatter): s += table.get_html_string() else: s += table.get_string() + + self.queue = [] + if self.return_only: return s else: diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index e6597b24..56640e81 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -303,16 +303,19 @@ class ReplApplication(Cmd, ConsoleApplication): self.set_formatter(formatter_name) try: - return super(ReplApplication, self).onecmd(line) - except CallErrors, e: - self.bcall_errors_handler(e) - except BackendNotGiven, e: - print >>sys.stderr, 'Error: %s' % str(e) - except NotEnoughArguments, e: - print >>sys.stderr, 'Error: not enough arguments. %s' % str(e) - except (KeyboardInterrupt, EOFError): - # ^C during a command process doesn't exit application. - print '\nAborted.' + try: + return super(ReplApplication, self).onecmd(line) + except CallErrors, e: + self.bcall_errors_handler(e) + except BackendNotGiven, e: + print >>sys.stderr, 'Error: %s' % str(e) + except NotEnoughArguments, e: + print >>sys.stderr, 'Error: not enough arguments. %s' % str(e) + except (KeyboardInterrupt, EOFError): + # ^C during a command process doesn't exit application. + print '\nAborted.' + finally: + self.flush() def emptyline(self): """