changeset 564:1ef087352e01 trunk

add more comparison methods to babel.messages.Catalog to ease the Python 3 transition
author fschwarz
date Sun, 25 Sep 2011 20:44:10 +0000
parents c6bc419cc32a
children b0e80df660ab
files babel/messages/catalog.py
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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,
Copyright (C) 2012-2017 Edgewall Software