From dd4af8cd6c0c49bdfc1ad25f759688d733d815ac Mon Sep 17 00:00:00 2001 From: Alexander Cherniuk Date: Sat, 17 Apr 2010 21:53:09 +0300 Subject: [PATCH] Do not clear the input, when there has been a command-related error --- src/command_system/implementation/middleware.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/command_system/implementation/middleware.py b/src/command_system/implementation/middleware.py index 7525fba20..5c28df0f8 100644 --- a/src/command_system/implementation/middleware.py +++ b/src/command_system/implementation/middleware.py @@ -36,13 +36,14 @@ class ChatCommandProcessor(CommandProcessor): def process_as_command(self, text): flag = super(ChatCommandProcessor, self).process_as_command(text) - if flag: + if flag and self.command_succeded: self.add_history(text) self.clear_input() return flag def execute_command(self, name, arguments): try: + self.command_succeded = False super(ChatCommandProcessor, self).execute_command(name, arguments) except NoCommandError, error: details = dict(name=error.name, message=error.message) @@ -55,6 +56,8 @@ class ChatCommandProcessor(CommandProcessor): except Exception: self.echo("An error occured while trying to execute the command", 'error') print_exc() + else: + self.command_succeded = True def looks_like_command(self, text, body, name, arguments): # Command escape stuff ggoes here. If text was prepended by the