]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
fix typos; simplify _check_cname_and_other_data 731/head
authorBob Halley <halley@dnspython.org>
Fri, 3 Dec 2021 19:39:50 +0000 (11:39 -0800)
committerBob Halley <halley@dnspython.org>
Fri, 3 Dec 2021 19:39:50 +0000 (11:39 -0800)
dns/node.py
dns/zonefile.py

index b3f57859d39addcb00b95471e2f0732e2c3d7c28..63ce008b938c0f1e4cb87eef2a4b2083d22cfba7 100644 (file)
@@ -69,8 +69,8 @@ class Node:
     """A Node is a set of rdatasets.
 
     A node is either a CNAME node or an "other data" node.  A CNAME
-    node contains only CNAME, KEY, RRSIG(CNAME), NSEC, RRSIG(NSEC), NSEC3,
-    or RRSIG(NSEC3) rdatasets.  An "other data" node contains any
+    node contains only CNAME, KEY, NSEC, and NSEC3 rdatasets along with their
+    covering RRSIG rdatasets.  An "other data" node contains any
     rdataset other than a CNAME or RRSIG(CNAME) rdataset.  When
     changes are made to a node, the CNAME or "other data" state is
     always consistent with the update, i.e. the most recent change
@@ -138,7 +138,7 @@ class Node:
         Specifically, if the rdataset being appended has ``NodeKind.CNAME``,
         then all rdatasets other than KEY, NSEC, NSEC3, and their covering
         RRSIGs are deleted.  If the rdataset being appended has
-        ``NodeKind.REGUALAR`` then CNAME and RRSIG(CNAME) are deleted.
+        ``NodeKind.REGULAR`` then CNAME and RRSIG(CNAME) are deleted.
         """
         # Make having just one rdataset at the node fast.
         if len(self.rdatasets) > 0:
index bcafe1d4b2c8f06c38a0385426235f9422896d8d..ce16abb44e788eff4528fd809ac6de3e45f3082f 100644 (file)
@@ -45,10 +45,10 @@ class CNAMEAndOtherData(dns.exception.DNSException):
 def _check_cname_and_other_data(txn, name, rdataset):
     rdataset_kind = dns.node.NodeKind.classify_rdataset(rdataset)
     node = txn.get_node(name)
-    if node is not None:
-        node_kind = node.classify()
-    else:
-        node_kind = dns.node.NodeKind.NEUTRAL
+    if node is None:
+        # empty nodes are neutral.
+        return
+    node_kind = node.classify()
     if node_kind == dns.node.NodeKind.CNAME and \
        rdataset_kind == dns.node.NodeKind.REGULAR:
         raise CNAMEAndOtherData('rdataset type is not compatible with a '