From 76056e35e445eb1252988f7271c8805587d67c92 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 10 Sep 2004 07:10:35 +0000 Subject: [PATCH] Let's handle non-IrcCallbacks for sorting. --- src/irclib.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index d1a6f3f88..0b23d4ea6 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -88,10 +88,13 @@ class IrcCallback(IrcCommandDispatcher): 'name': lambda self: self.__class__.__name__,} def __cmp__(self, other): - ret = cmp(self.priority, other.priority) - if not ret: - ret = cmp(self.name(), other.name()) - return ret + if isinstance(other, IrcCallback): + ret = cmp(self.priority, other.priority) + if ret == 0: + ret = cmp(self.name(), other.name()) + return ret + else: + return super(IrcCallback, self).__cmp__(other) def name(self): """Returns the name of the callback."""