From bf58677df5d774a55450cdb3de3dcbc79c5c5c22 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Sun, 1 May 2011 10:21:06 +0100 Subject: [PATCH] fix rdata comparisons when type or class differ --- dns/rdata.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dns/rdata.py b/dns/rdata.py index 586c5c3c..b79c902d 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): -- 2.47.3