pvl.dns.zone: remove ZoneLine.timestamp support
authorTero Marttila <tero.marttila@aalto.fi>
Fri, 27 Feb 2015 11:53:05 +0200
changeset 635 7bde9e5ce40f
parent 634 8ec17e8d16c0
child 636 d21df33dd1d4
pvl.dns.zone: remove ZoneLine.timestamp support
pvl/dns/zone.py
--- a/pvl/dns/zone.py	Fri Feb 27 10:55:15 2015 +0200
+++ b/pvl/dns/zone.py	Fri Feb 27 11:53:05 2015 +0200
@@ -143,7 +143,7 @@
      
 
     @classmethod
-    def parse (cls, file, filename=None, line_timestamp_prefix=None) :
+    def parse (cls, file, filename=None):
         """
             Yield ZoneLines lexed from a file.
         """
@@ -157,21 +157,6 @@
         for lineno, raw_line in enumerate(file) :
             raw_line = raw_line.rstrip('\n')
 
-            # possible mtime prefix for line
-            timestamp = None
-
-            if line_timestamp_prefix :
-                if ': ' not in raw_line :
-                    raise ZoneError("%s:%d: Missing timestamp prefix: %s" % (filename, lineno, raw_line))
-
-                # split prefix
-                prefix, raw_line = raw_line.split(': ', 1)
-
-                # parse it out
-                timestamp = datetime.datetime.strptime(prefix, cls.PARSE_DATETIME_FORMAT)
-
-                log.debug("%s:%d: ts=%r", filename, lineno, ts)
-            
             log.debug("%s:%d: %s", filename, lineno, raw_line)
             
             # capture indent from raw line
@@ -203,7 +188,7 @@
 
                 log.debug("%s:%d: Start of multi-line statement: %s", filename, lineno, line)
 
-                multiline_start = (lineno, timestamp, indent, comment)
+                multiline_start = (lineno, indent, comment)
                 multiline_line = raw_line
                 multiline_parts = []
 
@@ -219,7 +204,7 @@
 
                 log.debug("%s:%d: End of multi-line statement: %s", filename, lineno, line)
                 
-                lineno, timestamp, indent, comment = multiline_start
+                lineno, indent, comment = multiline_start
                 raw_line = multiline_line
                 parts = multiline_parts
 
@@ -229,7 +214,7 @@
             if multiline_start:
                 pass
             else:
-                yield ZoneLine(filename, lineno, raw_line, indent, parts, comment, timestamp=timestamp)
+                yield ZoneLine(filename, lineno, raw_line, indent, parts, comment)
 
     file = None
     lineno = None
@@ -239,12 +224,9 @@
     parts = None # split line fields
 
     # optional
-    timestamp = None
     comment = None
-
-    PARSE_DATETIME_FORMAT = '%Y-%m-%d'
     
-    def __init__ (self, file, lineno, line, indent, parts, comment=None, timestamp=None) :
+    def __init__ (self, file, lineno, line, indent, parts, comment=None) :
         # source
         self.file = file
         self.lineno = lineno
@@ -255,7 +237,6 @@
         self.parts = parts
         
         # metadata
-        self.timestamp = timestamp
         self.comment = comment
 
     def __unicode__ (self) :