Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
---------------------------------------------------------------
commit bd329ce4302b591db8d71c00695878d9d7de562c
Author: Peter Hatina <phatina(a)redhat.com>
Date: Thu Nov 1 11:19:13 2012 +0100
Lmi objects has to be callable due to tab-completion
---------------------------------------------------------------
cli-tools/lmi-shell.py | 4 +++-
cli-tools/lmi/lmi_client_shell.py | 3 +++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/cli-tools/lmi-shell.py b/cli-tools/lmi-shell.py
index 6a6d1bd..e8c5ced 100755
--- a/cli-tools/lmi-shell.py
+++ b/cli-tools/lmi-shell.py
@@ -41,12 +41,14 @@ class _LmiCompleter(rlcompleter.Completer):
def __completeObjectMethods(self, obj, text):
result = filter(lambda m: not m.startswith("_") \
+ and not m.startswith("m_") \
and callable(getattr(obj, m)) \
and m.lower().startswith(text.lower()), dir(obj))
return result
def _callable_postfix(self, val, word):
- if hasattr(val, '__call__'):
+ if hasattr(val, '__call__') \
+ and not isinstance(val, (_LmiNamespace, _LmiClass, _LmiInstance)):
word = word + "("
return word
diff --git a/cli-tools/lmi/lmi_client_shell.py b/cli-tools/lmi/lmi_client_shell.py
index 9c44dea..f40f3ea 100644
--- a/cli-tools/lmi/lmi_client_shell.py
+++ b/cli-tools/lmi/lmi_client_shell.py
@@ -51,6 +51,9 @@ class BaseObject(object):
def __members__(self):
return []
+ def __call__(self):
+ pass
+
class _LmiNamespace(BaseObject):
def __init__(self, client, name):
super(self.__class__, self).__init__()