[tor-commits] [stem/master] stop skipping unexpected "opt" lines

atagar at torproject.org atagar at torproject.org
Sat Oct 13 18:35:44 UTC 2012


commit f1ecbde2b5f00019ec171c44628c03c2f09e1952
Author: Ravi Chandra Padmala <neenaoffline at gmail.com>
Date:   Thu Aug 16 18:18:09 2012 +0530

    stop skipping unexpected "opt" lines
---
 stem/descriptor/__init__.py |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index 6563e4b..1372e17 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -203,18 +203,11 @@ def _read_keyword_line(keyword, descriptor_file, validate = True, optional = Fal
       raise ValueError("Unexpected end of document")
     return None
   
-  opt_line = False
   if line.startswith("opt "):
     line = line[4:]
-    opt_line = True
   if re.match("^" + re.escape(keyword) + "($| )", line):
     descriptor_file.readline()
     return line[len(keyword):].strip()
-  elif opt_line and not optional:
-    # if this is something new we don't recognize
-    # ignore it and go to the next line
-    descriptor_file.readline()
-    return _read_keyword_line(keyword, descriptor_file, optional)
   elif not optional and validate:
     raise ValueError("Error parsing network status document: Expected %s, received: %s" % (keyword, line))
   else: return None
@@ -242,18 +235,12 @@ def _read_keyword_line_str(keyword, lines, validate = True, optional = False):
       raise ValueError("Unexpected end of document")
     return
   
-  opt_line = False
   if lines[0].startswith("opt "):
     line = line[4:]
-    opt_line = True
   if line_matches_keyword(keyword, lines[0]):
     line = lines.pop(0)
     
     return line[len(keyword):].strip()
-  elif opt_line and not optional:
-    # if this is something new we don't recognize yet
-    # ignore it and go to the next line
-    return _read_keyword_line_str(keyword, lines, optional)
   elif not optional and validate:
     raise ValueError("Error parsing network status document: Expected %s, received: %s" % (keyword, lines[0]))
   else: return None





More information about the tor-commits mailing list