Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : 0.9-fixes
commit d9dd28a3b5988c7d7036eb3b857e09f15ea13bb1 Author: Peter Hatina phatina@redhat.com Date: Wed Nov 13 08:59:07 2013 +0100
LMIInstance(Name) is comparable to any other types
cli/lmi/shell/LMIInstance.py | 2 ++ cli/lmi/shell/LMIInstanceName.py | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/cli/lmi/shell/LMIInstance.py b/cli/lmi/shell/LMIInstance.py index 17ca570..eb00439 100644 --- a/cli/lmi/shell/LMIInstance.py +++ b/cli/lmi/shell/LMIInstance.py @@ -58,6 +58,8 @@ class LMIInstance(LMIWrapperBaseObject): instance is deleted, -1 or 1 is returned. :rtype: int """ + if not isinstance(other, LMIInstance): + return -1 if self._deleted and not other._deleted: return -1 elif not self._deleted and other._deleted: diff --git a/cli/lmi/shell/LMIInstanceName.py b/cli/lmi/shell/LMIInstanceName.py index 08f8eb7..51e0a13 100644 --- a/cli/lmi/shell/LMIInstanceName.py +++ b/cli/lmi/shell/LMIInstanceName.py @@ -40,6 +40,8 @@ class LMIInstanceName(LMIWrapperBaseObject): number, if self > other :rtype: int """ + if not isinstance(other, LMIInstanceName): + return -1 return cmp(self._cim_instance_name, other._cim_instance_name)
def __contains__(self, key):
cura-tools-devel@lists.fedorahosted.org