From: Felix Schwarz Date: Sun, 25 Sep 2011 20:44:10 +0000 (+0000) Subject: add more comparison methods to babel.messages.Catalog to ease the Python 3 transition X-Git-Tag: 1.0~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf600a005260ff1c0ae5eeee68d33c15f9a4858b;p=thirdparty%2Fbabel.git 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 index ffd22be6..7ec66491 100644 --- a/babel/messages/catalog.py +++ b/babel/messages/catalog.py @@ -100,6 +100,24 @@ class Message(object): 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,