raise NotImplementedError # pragma: no cover
def origin_information(self):
- """Returns an (origin: ``dns.name.Name``, relativize: ``bool``) tuple
- giving the absolute name of the default origin for any
- relative domain names, and whether names should be relativized
- to that origin.
+ """Returns a tuple
+
+ (absolute_origin, relativize, effective_origin)
- If the returned name is `None`, then no origin information is
+ giving the absolute name of the default origin for any
+ relative domain names, the "effective origin", and whether
+ names should be relativized. The "effective origin" is the
+ absolute origin if relativize is False, and the empty name if
+ relativize is true. (The effective origin is provided even
+ though it can be computed from the absolute_origin and
+ relativize setting because it avoids a lot of code
+ duplication.)
+
+ If the returned names are `None`, then no origin information is
available.
This information is used by code working with transactions to
if self.get_rdataset(name, dns.rdatatype.NS) is None:
raise NoNS
+ # TransactionManager methods
+
def reader(self):
return Transaction(self, False, True)
return Transaction(self, replacement, False)
def origin_information(self):
- return (self.origin, self.relativize)
+ if self.relativize:
+ effective = dns.name.empty
+ else:
+ effective = self.origin
+ return (self.origin, self.relativize, effective)
def get_class(self):
return self.rdclass
def __init__(self, tok, rdclass, txn, allow_include=False):
self.tok = tok
- (self.zone_origin, self.relativize) = txn.manager.origin_information()
+ (self.zone_origin, self.relativize, _) = \
+ txn.manager.origin_information()
self.current_origin = self.zone_origin
self.last_ttl = 0
self.last_ttl_known = False