summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2012-04-07 22:15:56 +0100
committerBob Halley <halley@dnspython.org>2012-04-07 22:15:56 +0100
commitd128fe0847580dfeeba06a9b0618edd531619461 (patch)
tree649b5a16f8abfe7e4af8300649eea2de0272048c
parentc411ec81ba3a03cd47cc353e5686595899ca311b (diff)
downloaddnspython-d128fe0847580dfeeba06a9b0618edd531619461.tar.gz
add check_origin parameter to dns.zone.from_xfr()
-rw-r--r--ChangeLog6
-rw-r--r--dns/zone.py8
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 46064a5..5ab9838 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
+
2012-04-07 Bob Halley <halley@dnspython.org>
+ * dns/zone.py (from_xfr): dns.zone.from_xfr() now takes a
+ 'check_origin' parameter which defaults to True. If set to
+ False, then dnspython will not make origin checks on the zone.
+ Thanks to Carlos Perez for the report.
+
* dns/rdtypes/ANY/SSHFP.py (SSHFP.from_text): Allow whitespace in
the text string. Thanks to Jan Andres for the report and the
patch.
diff --git a/dns/zone.py b/dns/zone.py
index 67c952d..ac16ad3 100644
--- a/dns/zone.py
+++ b/dns/zone.py
@@ -817,7 +817,7 @@ def from_file(f, origin = None, rdclass = dns.rdataclass.IN,
f.close()
return z
-def from_xfr(xfr, zone_factory=Zone, relativize=True):
+def from_xfr(xfr, zone_factory=Zone, relativize=True, check_origin=True):
"""Convert the output of a zone transfer generator into a zone object.
@param xfr: The xfr generator
@@ -826,6 +826,9 @@ def from_xfr(xfr, zone_factory=Zone, relativize=True):
It is essential that the relativize setting matches the one specified
to dns.query.xfr().
@type relativize: bool
+ @param check_origin: should sanity checks of the origin node be done?
+ The default is True.
+ @type check_origin: bool
@raises dns.zone.NoSOA: No SOA RR was found at the zone origin
@raises dns.zone.NoNS: No NS RRset was found at the zone origin
@rtype: dns.zone.Zone object
@@ -851,5 +854,6 @@ def from_xfr(xfr, zone_factory=Zone, relativize=True):
for rd in rrset:
rd.choose_relativity(z.origin, relativize)
zrds.add(rd)
- z.check_origin()
+ if check_origin:
+ z.check_origin()
return z