diff options
| author | Bob Halley <halley@dnspython.org> | 2014-08-31 17:02:56 -0700 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2014-08-31 17:02:56 -0700 |
| commit | b87ddf4414b54d4ef1f0b033d99b66743e5847d8 (patch) | |
| tree | 88bb286e2373e9439881ba81c39bb25529a581e4 | |
| parent | f94224d330ee4204eb9cd6a3225e7f08787cf614 (diff) | |
| download | dnspython-b87ddf4414b54d4ef1f0b033d99b66743e5847d8.tar.gz | |
Fix exception when reading from a masterfile.
| -rw-r--r-- | dns/zone.py | 2 | ||||
| -rw-r--r-- | tests/zone.py | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/dns/zone.py b/dns/zone.py index a5f4f9c..9a8fc22 100644 --- a/dns/zone.py +++ b/dns/zone.py @@ -565,7 +565,7 @@ class _MasterReader(object): 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 diff --git a/tests/zone.py b/tests/zone.py index 61f4148..67fc2ae 100644 --- a/tests/zone.py +++ b/tests/zone.py @@ -394,5 +394,14 @@ class ZoneTestCase(unittest.TestCase): relativize=True) self.assertRaises(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.assertTrue(rds.ttl == 0) + if __name__ == '__main__': unittest.main() |
