summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-12-21 11:43:19 -0800
committerBob Halley <halley@dnspython.org>2020-12-21 11:43:19 -0800
commit960a48bbc05a3d554eb0a768c7f583dbbc8ae205 (patch)
treeed4702108a08c1dda72edd556d4d35ec24bb7cc5
parentd4a7bd69f2d678f04134556e1587633d39c74a00 (diff)
downloaddnspython-resolve_chaining.tar.gz
Change ChainingResult "rrset" to "answer"; fix typo.resolve_chaining
-rw-r--r--dns/message.py20
-rw-r--r--dns/resolver.py4
-rw-r--r--tests/test_message.py2
3 files changed, 13 insertions, 13 deletions
diff --git a/dns/message.py b/dns/message.py
index 0293e3a..428c98e 100644
--- a/dns/message.py
+++ b/dns/message.py
@@ -728,7 +728,7 @@ class Message:
class ChainingResult:
"""The result of a call to dns.message.QueryMessage.resolve_chaining().
- The ``rrset`` attribute is the answer RRSet, or ``None`` if it doesn't
+ The ``answer`` attribute is the answer RRSet, or ``None`` if it doesn't
exist.
The ``canonical_name`` attribute is the canonical name after all
@@ -743,9 +743,9 @@ class ChainingResult:
The ``cnames`` attribute is a list of all the CNAME RRSets followed to
get to the canonical name.
"""
- def __init__(self, canonical_name, rrset, minimum_ttl, cnames):
+ def __init__(self, canonical_name, answer, minimum_ttl, cnames):
self.canonical_name = canonical_name
- self.rrset = rrset
+ self.answer = answer
self.minimum_ttl = minimum_ttl
self.cnames = cnames
@@ -774,14 +774,14 @@ class QueryMessage(Message):
question = self.question[0]
qname = question.name
min_ttl = dns.ttl.MAX_TTL
- rrset = None
+ answer = None
count = 0
cnames = []
while count < MAX_CHAIN:
try:
- rrset = self.find_rrset(self.answer, qname, question.rdclass,
- question.rdtype)
- min_ttl = min(min_ttl, rrset.ttl)
+ answer = self.find_rrset(self.answer, qname, question.rdclass,
+ question.rdtype)
+ min_ttl = min(min_ttl, answer.ttl)
break
except KeyError:
if question.rdtype != dns.rdatatype.CNAME:
@@ -804,9 +804,9 @@ class QueryMessage(Message):
break
if count >= MAX_CHAIN:
raise ChainTooLong
- if self.rcode() == dns.rcode.NXDOMAIN and rrset is not None:
+ if self.rcode() == dns.rcode.NXDOMAIN and answer is not None:
raise AnswerForNXDOMAIN
- if rrset is None:
+ if answer is None:
# Further minimize the TTL with NCACHE.
auname = qname
while True:
@@ -823,7 +823,7 @@ class QueryMessage(Message):
auname = auname.parent()
except dns.name.NoParent:
break
- return ChainingResult(qname, rrset, min_ttl, cnames)
+ return ChainingResult(qname, answer, min_ttl, cnames)
def canonical_name(self):
"""Return the canonical name of the first name in the question
diff --git a/dns/resolver.py b/dns/resolver.py
index d04386f..7bdfd91 100644
--- a/dns/resolver.py
+++ b/dns/resolver.py
@@ -212,9 +212,9 @@ class Answer:
self.port = port
self.chaining_result = response.resolve_chaining()
# Copy some attributes out of chaining_result for backwards
- # compatibilty and convenience.
+ # compatibility and convenience.
self.canonical_name = self.chaining_result.canonical_name
- self.rrset = self.chaining_result.rrset
+ self.rrset = self.chaining_result.answer
self.expiration = time.time() + self.chaining_result.minimum_ttl
def __getattr__(self, attr): # pragma: no cover
diff --git a/tests/test_message.py b/tests/test_message.py
index 6f62339..ed48e7b 100644
--- a/tests/test_message.py
+++ b/tests/test_message.py
@@ -563,7 +563,7 @@ example. 300 IN SOA . . 1 2 3 4 5
self.assertEqual(result.canonical_name,
dns.name.from_text('www.example.'))
self.assertEqual(result.minimum_ttl, 5)
- self.assertIsNone(result.rrset)
+ self.assertIsNone(result.answer)
def test_bad_text_questions(self):
with self.assertRaises(dns.exception.SyntaxError):