]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
fix rdata comparisons when type or class differ
authorBob Halley <halley@nominum.com>
Sun, 1 May 2011 09:21:06 +0000 (10:21 +0100)
committerBob Halley <halley@nominum.com>
Sun, 1 May 2011 09:21:06 +0000 (10:21 +0100)
dns/rdata.py

index 586c5c3cc81889c40d05c3e7089f43e4946d9358..b79c902d18bcc9b220659a4d02e0d72292a2f963 100644 (file)
@@ -207,7 +207,6 @@ class Rdata(object):
         rdclass.  Return < 0 if self < other in the DNSSEC ordering,
         0 if self == other, and > 0 if self > other.
         """
-
         raise NotImplementedError
 
     def __eq__(self, other):
@@ -231,7 +230,7 @@ class Rdata(object):
             return NotImplemented
         if self.rdclass != other.rdclass or \
                self.rdtype != other.rdtype:
-            return dns.util.cmp((self.rdclass, self.rdtype), (other.rdclass, other.rdtype))
+            return (self.rdclass, self.rdtype) < (other.rdclass, other.rdtype)
         return self._cmp(other) < 0
 
     def __le__(self, other):
@@ -239,7 +238,7 @@ class Rdata(object):
             return NotImplemented
         if self.rdclass != other.rdclass or \
                self.rdtype != other.rdtype:
-            return dns.util.cmp((self.rdclass, self.rdtype), (other.rdclass, other.rdtype))
+            return (self.rdclass, self.rdtype) <= (other.rdclass, other.rdtype)
         return self._cmp(other) <= 0
 
     def __ge__(self, other):
@@ -247,7 +246,7 @@ class Rdata(object):
             return NotImplemented
         if self.rdclass != other.rdclass or \
                self.rdtype != other.rdtype:
-            return dns.util.cmp((self.rdclass, self.rdtype), (other.rdclass, other.rdtype))
+            return (self.rdclass, self.rdtype) >= (other.rdclass, other.rdtype)
         return self._cmp(other) >= 0
 
     def __gt__(self, other):
@@ -255,7 +254,7 @@ class Rdata(object):
             return NotImplemented
         if self.rdclass != other.rdclass or \
                self.rdtype != other.rdtype:
-            return dns.util.cmp((self.rdclass, self.rdtype), (other.rdclass, other.rdtype))
+            return (self.rdclass, self.rdtype) > (other.rdclass, other.rdtype)
         return self._cmp(other) > 0
 
     def __hash__(self):