]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Change ChainingResult "rrset" to "answer"; fix typo. 614/head
authorBob Halley <halley@dnspython.org>
Mon, 21 Dec 2020 19:43:19 +0000 (11:43 -0800)
committerBob Halley <halley@dnspython.org>
Mon, 21 Dec 2020 19:43:19 +0000 (11:43 -0800)
dns/message.py
dns/resolver.py
tests/test_message.py

index 0293e3a2825666a8217230308fa40e60a0b9bd19..428c98e051392911e6d3980190070f226b72b5c8 100644 (file)
@@ -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
index d04386fc84bdb0f0fefdffb7635e65c7013b6fe6..7bdfd91fc3be896d9f7040a3b418dd15ba3fba1c 100644 (file)
@@ -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
index 6f62339df5a134a11b030c78929788f7570be019..ed48e7bdfccb5925a00ab975e57dd62a8a8753cb 100644 (file)
@@ -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):