Let's handle non-IrcCallbacks for sorting.

This commit is contained in:
Jeremy Fincher 2004-09-10 07:10:35 +00:00
parent 8edb880af0
commit 76056e35e4

View File

@ -88,10 +88,13 @@ class IrcCallback(IrcCommandDispatcher):
'name': lambda self: self.__class__.__name__,} 'name': lambda self: self.__class__.__name__,}
def __cmp__(self, other): def __cmp__(self, other):
ret = cmp(self.priority, other.priority) if isinstance(other, IrcCallback):
if not ret: ret = cmp(self.priority, other.priority)
ret = cmp(self.name(), other.name()) if ret == 0:
return ret ret = cmp(self.name(), other.name())
return ret
else:
return super(IrcCallback, self).__cmp__(other)
def name(self): def name(self):
"""Returns the name of the callback.""" """Returns the name of the callback."""