Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
commit 03a5614b042ee1b2f348e8ff2ac151b45a2ba38e Author: Peter Hatina phatina@redhat.com Date: Mon Jun 24 13:45:01 2013 +0200
introduce use_exceptions config item
cli-tools/lmishell | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/cli-tools/lmishell b/cli-tools/lmishell index 1d7009e..a12233e 100755 --- a/cli-tools/lmishell +++ b/cli-tools/lmishell @@ -186,6 +186,7 @@ class LmiInteractiveShellConfig(object): DEFAULT_HISTORY_FILE = "~/.lmi_shell_history" DEFAULT_HISTORY_LENGTH = -1 DEFAULT_USE_CACHE = True + DEFAULT_USE_EXCEPTIONS = False
def __init__(self): try: @@ -197,12 +198,15 @@ class LmiInteractiveShellConfig(object): LmiInteractiveShellConfig.DEFAULT_HISTORY_LENGTH) self._use_cache = get_item_or_default(conf, "use_cache", LmiInteractiveShellConfig.DEFAULT_USE_CACHE) + self._use_exceptions = get_item_or_default(conf, "use_exceptions", + LmiInteractiveShellConfig.DEFAULT_USE_EXCEPTIONS) except (SyntaxError, IOError), e: if isinstance(e, SyntaxError): sys.stderr.write("Error: %s\n" % e) self._history_file = os.path.expanduser(LmiInteractiveShellConfig.DEFAULT_HISTORY_FILE) self._history_length = LmiInteractiveShellConfig.DEFAULT_HISTORY_LENGTH self._use_cache = LmiInteractiveShellConfig.DEFAULT_USE_CACHE + self._use_exceptions = LmiInteractiveShellConfig.DEFAULT_USE_EXCEPTIONS
@property def history_file(self): @@ -216,6 +220,10 @@ class LmiInteractiveShellConfig(object): def use_cache(self): return self._use_cache
+ @property + def use_exceptions(self): + return self._use_exceptions + class LmiInteractiveShell(code.InteractiveConsole): DEFAULT_LOCALS = { "LmiConnection" : LmiConnection, @@ -247,6 +255,7 @@ class LmiInteractiveShell(code.InteractiveConsole): locals["connect"] = lambda h, u = "", p = "": _connect(h, u, p, True, self._use_cache) readline.set_completer(self._completer.complete) readline.parse_and_bind('tab: complete') + LmiBaseClient._set_use_exceptions(config.use_exceptions)
def interact(self): self.load_history()
cura-tools-devel@lists.fedorahosted.org