]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
add a __hash__() method for rdata
authorBob Halley <halley@nominum.com>
Fri, 10 Dec 2010 18:48:54 +0000 (10:48 -0800)
committerBob Halley <halley@nominum.com>
Fri, 10 Dec 2010 18:48:54 +0000 (10:48 -0800)
ChangeLog
dns/rdata.py

index 91e69d3ea2f2d45ec39ff17afb1e2dce36f152d7..cfbd23b770e6758dfbda6e0c55a26a4557cb9a45 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-10  Bob Halley  <halley@dnspython.org>
+
+       * dns/rdata.py (Rdata.__hash__): Added a __hash__ method for rdata.
+
 2010-11-23  Bob Halley  <halley@dnspython.org>
 
        * (Version 1.9.2 released)
index ce0268697b0aa5c7e03024c959d23b9257c77cd6..399677e984d697631d785802da58c2711751bb93 100644 (file)
@@ -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.