]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
treat leading whitespace followed by EOL/EOF as a blank line
authorBob Halley <halley@dnspython.org>
Fri, 2 Sep 2005 05:22:23 +0000 (05:22 +0000)
committerBob Halley <halley@dnspython.org>
Fri, 2 Sep 2005 05:22:23 +0000 (05:22 +0000)
Original author: Bob Halley <halley@dnspython.org>
Date: 2004-04-09 10:09:59

ChangeLog
dns/zone.py
tests/example

index 57b1b152a80f998a9d048ee18e3e6211c8c38e09..2b430a1c88503c3c7c3f46b015aaa08b83c9f879 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 711e26d11ce5c0d8a5471fdd6d9d0a94d63c94fc..002366b17cb8c91a4aaaebbca12eb94e92c62693 100644 (file)
@@ -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()
index 1b96f1bd99386d6ba970237c9b081ca235d0885f..f57e968f4770c5cd1e5abb57fc0ae96e9fb368aa 100644 (file)
@@ -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