- def __cmp__(self, other):
- c = cmp(self.score, other.score)
- if c == 0:
- # this is inverted, because earlier date is better
- return cmp(other.published_date, self.published_date)
- else:
- return c
+ def __lt__(self, other):
+ return (-self.score, self.published_date, self.book.sort_key_author, self.book.sort_key) > \
+ (-other.score, other.published_date, other.book.sort_key_author, other.book.sort_key)
+
+ def __eq__(self, other):
+ return (self.score, self.published_date, self.book.sort_key_author, self.book.sort_key) == \
+ (other.score, other.published_date, other.book.sort_key_author, other.book.sort_key)