kerberos: fix sorting Principal objects

When service-find was issued under Python 3, the command fails
because it tried to sort a list of Principal objects which was not
possible.

https://pagure.io/freeipa/issue/4985

Reviewed-By: Felipe Volpone <fbarreto@redhat.com>
This commit is contained in:
Stanislav Laznicka 2017-08-02 15:59:39 +02:00 committed by Pavel Vomacka
parent 7995518921
commit dbeb41efd6

View File

@ -93,6 +93,18 @@ class Principal(object):
def __ne__(self, other):
return not self.__eq__(other)
def __lt__(self, other):
return unicode(self) < unicode(other)
def __le__(self, other):
return self.__lt__(other) or self.__eq__(other)
def __gt__(self, other):
return not self.__le__(other)
def __ge__(self, other):
return self.__gt__(other) or self.__eq__(other)
def __hash__(self):
return hash(self.components + (self.realm,))