summaryrefslogtreecommitdiff
path: root/dns/zone.py
diff options
context:
space:
mode:
authorBrian Wellington <bwelling@xbill.org>2020-03-18 16:44:09 -0700
committerBrian Wellington <bwelling@xbill.org>2020-03-18 16:44:09 -0700
commitcee00834c8ef0c1a0bebbeb98f5e0c97d39ad0d4 (patch)
tree930da1b29884daa1a5d38d63387b49fb41181ced /dns/zone.py
parent41ca1be22dad341709a3856f34fe63aa46da1d1b (diff)
downloaddnspython-cee00834c8ef0c1a0bebbeb98f5e0c97d39ad0d4.tar.gz
Add relativize_to to from_text().
When calling from_text, the zone code needs to apply the current origin (which may or may not be the zone origin, if sub-zone $ORIGIN statements are present), and may also want to relativize the contents to the zone origin. Previously, this was done by explicitly reading records as absolute, and then relativizing them laster. With this change, the work is moved to the tokenizer. This gets rid of the remaining internal uses of dns.rdata.choose_relativity(), which prevents rdata from being immutable.
Diffstat (limited to 'dns/zone.py')
-rw-r--r--dns/zone.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/dns/zone.py b/dns/zone.py
index 0da4d89..4d21dfb 100644
--- a/dns/zone.py
+++ b/dns/zone.py
@@ -698,7 +698,8 @@ class _MasterReader(object):
self.zone.nodes[name] = n
try:
rd = dns.rdata.from_text(rdclass, rdtype, self.tok,
- self.current_origin, False)
+ self.current_origin, self.relativize,
+ self.zone.origin)
except dns.exception.SyntaxError:
# Catch and reraise.
(ty, va) = sys.exc_info()[:2]
@@ -730,7 +731,6 @@ class _MasterReader(object):
else:
ttl = self.last_ttl
- rd.choose_relativity(self.zone.origin, self.relativize)
covers = rd.covers()
rds = n.find_rdataset(rdclass, rdtype, covers, True)
rds.add(rd, ttl)
@@ -879,7 +879,8 @@ class _MasterReader(object):
self.zone.nodes[name] = n
try:
rd = dns.rdata.from_text(rdclass, rdtype, rdata,
- self.current_origin, False)
+ self.current_origin, self.relativize,
+ self.zone.origin)
except dns.exception.SyntaxError:
# Catch and reraise.
(ty, va) = sys.exc_info()[:2]
@@ -894,7 +895,6 @@ class _MasterReader(object):
raise dns.exception.SyntaxError("caught exception %s: %s" %
(str(ty), str(va)))
- rd.choose_relativity(self.zone.origin, self.relativize)
covers = rd.covers()
rds = n.find_rdataset(rdclass, rdtype, covers, True)
rds.add(rd, ttl)