Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
---------------------------------------------------------------
commit 728f23f9295d7061870e6d7b734aa7bb669e8161
Author: Peter Hatina <phatina(a)redhat.com>
Date: Thu Nov 29 13:30:48 2012 +0100
override CIM::__repr__ in LMI classes
---------------------------------------------------------------
cli-tools/lmi/lmi_client_shell.py | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/cli-tools/lmi/lmi_client_shell.py b/cli-tools/lmi/lmi_client_shell.py
index 08a1d5e..3a4dfc7 100644
--- a/cli-tools/lmi/lmi_client_shell.py
+++ b/cli-tools/lmi/lmi_client_shell.py
@@ -243,6 +243,9 @@ class _LmiNamespace(BaseObject):
return _LmiErrorHandler("Error: %s" % errorstr)
return _LmiClass(self._client, self, klass)
+ def __repr__(self):
+ return "%s(namespace='%s', ...)" % (self.__class__.__name__,
self._name)
+
def classes(self, filter_key = "", exact_match = False):
(class_name_list, errorstr) = self._client.get_class_names(self._name)
if not class_name_list:
@@ -270,6 +273,9 @@ class _LmiClass(BaseObject):
self._namespace = namespace
self._class = klass
+ def __repr__(self):
+ return "%s(classname='%s', ...)" % (self.__class__.__name__,
self.classname)
+
def doc(self):
_LmiXmlFormatter(self._class.tocimxml()).fancy_format(self._client.interactive)
@@ -315,6 +321,9 @@ class _LmiInstanceName(BaseObject):
self._client = client
self._instance_name = instance_name
+ def __repr__(self):
+ return "%s(...)" % self.__class__.__name__
+
def to_instance(self):
(cim_inst, errorstr) = self._client.get_instance(self._instance_name)
if not cim_inst:
@@ -408,9 +417,6 @@ class _LmiInstance(BaseObject):
self._class = klass
self._inst = inst
- def __str__(self):
- return str(self._inst)
-
def __getattr__(self, name):
methods = self.__methods()
if methods and name in methods:
@@ -422,6 +428,9 @@ class _LmiInstance(BaseObject):
def __getitem__(self, key):
return self.__getattr__(key)
+ def __repr__(self):
+ return "%s(classname='%s', ...)" % (self.__class__.__name__,
self.classname)
+
def __methods(self):
(klass, errorstr) = self._client.get_class(self._inst.classname,
self._class.namespace)
if not klass: