]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
add more comparison methods to babel.messages.Catalog to ease the Python 3 transition
authorFelix Schwarz <felix.schwarz@oss.schwarz.eu>
Sun, 25 Sep 2011 20:44:10 +0000 (20:44 +0000)
committerFelix Schwarz <felix.schwarz@oss.schwarz.eu>
Sun, 25 Sep 2011 20:44:10 +0000 (20:44 +0000)
babel/messages/catalog.py

index ffd22be651634e0b2fee02692d3d796147b87c76..7ec66491f062af74545f5507fd46bd13ed1d8915 100644 (file)
@@ -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,