+2014-06-21 Bob Halley <halley@dnspython.org>
+
+ * When reading from a masterfile, if the first content line started
+ with leading whitespace, we raised an ugly exception instead of
+ doing the right thing, namely using the zone origin as the name.
+ [#73]
+
2014-06-19 Bob Halley <halley@dnspython.org>
* Escaping of Unicode has been corrected. Previously we escaped and
self.current_origin = origin
self.relativize = relativize
self.ttl = 0
- self.last_name = None
+ self.last_name = self.current_origin
self.zone = zone_factory(origin, rdclass, relativize=relativize)
self.saved_state = []
self.current_file = None
for n in names:
print >> f, z[n].to_text(n)
self.failUnless(f.getvalue() == example_text_output)
-
+
def testTorture1(self):
#
# Read a zone containing all our supported RR types, and
relativize=True)
self.failUnlessRaises(dns.exception.SyntaxError, bad)
+ def testFirstRRStartsWithWhitespace(self):
+ # no name is specified, so default to the intial origin
+ # no ttl is specified, so default to the initial TTL of 0
+ z = dns.zone.from_text(' IN A 10.0.0.1', origin='example.',
+ check_origin=False)
+ n = z['@']
+ rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
+ self.failUnless(rds.ttl == 0)
+
if __name__ == '__main__':
unittest.main()