# HG changeset patch # User fschwarz # Date 1316983450 0 # Node ID 1ef087352e01be8fd32f3b501b79f76486de74eb # Parent c6bc419cc32ab8bf4c84d62361459fbf28d047ff add more comparison methods to babel.messages.Catalog to ease the Python 3 transition diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py --- a/babel/messages/catalog.py +++ b/babel/messages/catalog.py @@ -100,6 +100,24 @@ return cmp(self.id, obj.id[0]) return cmp(self.id, obj.id) + def __gt__(self, other): + return self.__cmp__(other) > 0 + + def __lt__(self, other): + return self.__cmp__(other) < 0 + + def __ge__(self, other): + return self.__cmp__(other) >= 0 + + def __le__(self, other): + return self.__cmp__(other) <= 0 + + def __eq__(self, other): + return self.__cmp__(other) == 0 + + def __ne__(self, other): + return self.__cmp__(other) != 0 + def clone(self): return Message(*map(copy, (self.id, self.string, self.locations, self.flags, self.auto_comments,