From: Bob Halley Date: Fri, 10 Dec 2010 18:48:54 +0000 (-0800) Subject: add a __hash__() method for rdata X-Git-Tag: v1.9.3~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3696ca3ccdc53166594bf89e018b4ea4952dc51b;p=thirdparty%2Fdnspython.git add a __hash__() method for rdata --- diff --git a/ChangeLog b/ChangeLog index 91e69d3e..cfbd23b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-12-10 Bob Halley + + * dns/rdata.py (Rdata.__hash__): Added a __hash__ method for rdata. + 2010-11-23 Bob Halley * (Version 1.9.2 released) diff --git a/dns/rdata.py b/dns/rdata.py index ce026869..399677e9 100644 --- a/dns/rdata.py +++ b/dns/rdata.py @@ -28,6 +28,7 @@ chunk of hexstring that _hexify() produces before whitespace occurs. import cStringIO import dns.exception +import dns.name import dns.rdataclass import dns.rdatatype import dns.tokenizer @@ -252,6 +253,9 @@ class Rdata(object): return NotImplemented return self._cmp(other) > 0 + def __hash__(self): + return hash(self.to_digestable(dns.name.root)) + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): """Build an rdata object from text format.