diff options
| author | Bob Halley <halley@dnspython.org> | 2005-09-02 05:22:23 +0000 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2005-09-02 05:22:23 +0000 |
| commit | 54fd6bc9dec868e903535d8164f255ae8d1b8712 (patch) | |
| tree | f75a6468de890abee2e8a769231e737340a3cc10 | |
| parent | e163f6673e47268575741f377592847df97196df (diff) | |
| download | dnspython-54fd6bc9dec868e903535d8164f255ae8d1b8712.tar.gz | |
treat leading whitespace followed by EOL/EOF as a blank line
Original author: Bob Halley <halley@dnspython.org>
Date: 2004-04-09 10:09:59
| -rw-r--r-- | ChangeLog | 11 | ||||
| -rw-r--r-- | dns/zone.py | 7 | ||||
| -rw-r--r-- | tests/example | 7 |
3 files changed, 25 insertions, 0 deletions
@@ -1,3 +1,14 @@ +2004-04-09 Bob Halley <halley@dnspython.org> + + * dns/zone.py (_MasterReader._rr_line): The masterfile reader + erroneously treated lines starting with leading whitespace but + not having any RR definition as an error. It now treats + them like a blank line (which is not an error). + +2004-04-01 Bob Halley <halley@dnspython.org> + + * (Version 1.3.0 released) + 2004-03-19 Bob Halley <halley@dnspython.org> * Added support for new DNSSEC types RRSIG, NSEC, and DNSKEY. diff --git a/dns/zone.py b/dns/zone.py index 711e26d..002366b 100644 --- a/dns/zone.py +++ b/dns/zone.py @@ -567,6 +567,13 @@ class _MasterReader(object): token = self.tok.get(want_leading = True) if token[0] != dns.tokenizer.WHITESPACE: self.last_name = dns.name.from_text(token[1], self.current_origin) + else: + token = self.tok.get() + if token[0] == dns.tokenizer.EOL or \ + token[0] == dns.tokenizer.EOF: + # treat leading WS followed by EOL/EOF as if they were EOL/EOF. + return + self.tok.unget(token) name = self.last_name if not name.is_subdomain(self.zone.origin): self._eat_line() diff --git a/tests/example b/tests/example index 1b96f1b..f57e968 100644 --- a/tests/example +++ b/tests/example @@ -33,6 +33,13 @@ $ORIGIN example. * MX 10 mail a TXT "foo foo foo" PTR foo.net. +;; The next line not starting with ';;' is leading whitespace followed by +;; EOL. We want to treat that as if EOL had appeared alone. + +;; The next line not starting with ';;' is leading whitespace followed by +;; a comment followed by EOL. We want to treat that as if EOL had appeared +;; alone. + ; foo $TTL 3600 ; 1 hour a01 A 0.0.0.0 a02 A 255.255.255.255 |
