From: Bob Halley Date: Sun, 1 May 2011 09:21:06 +0000 (+0100) Subject: fix rdata comparisons when type or class differ X-Git-Tag: v1.10.0-py3~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf58677df5d774a55450cdb3de3dcbc79c5c5c22;p=thirdparty%2Fdnspython.git fix rdata comparisons when type or class differ --- 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):