summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@nominum.com>2011-05-01 10:21:06 +0100
committerBob Halley <halley@nominum.com>2011-05-01 10:21:06 +0100
commitbf58677df5d774a55450cdb3de3dcbc79c5c5c22 (patch)
tree5ecdc44fb10e51f12c33ae88d7519fe9586264b4
parent83d4e072e527142516a0c3fff398d461a4afd304 (diff)
downloaddnspython-bf58677df5d774a55450cdb3de3dcbc79c5c5c22.tar.gz
fix rdata comparisons when type or class differ
-rw-r--r--dns/rdata.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/dns/rdata.py b/dns/rdata.py
index 586c5c3..b79c902 100644
--- a/dns/rdata.py
+++ b/dns/rdata.py
@@ -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):