From: Bob Halley Date: Fri, 3 Dec 2021 19:39:50 +0000 (-0800) Subject: fix typos; simplify _check_cname_and_other_data X-Git-Tag: v2.2.0rc1~19^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c46a91d5926e7ddaa32a466572c4b87dea46aa69;p=thirdparty%2Fdnspython.git fix typos; simplify _check_cname_and_other_data --- diff --git a/dns/node.py b/dns/node.py index b3f57859..63ce008b 100644 --- a/dns/node.py +++ b/dns/node.py @@ -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: diff --git a/dns/zonefile.py b/dns/zonefile.py index bcafe1d4..ce16abb4 100644 --- a/dns/zonefile.py +++ b/dns/zonefile.py @@ -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 '