changeset 11:0b28010f6c78 draft

fix config parsing Signed-off-by: Changaco <changaco ατ changaco δοτ net>
author Changaco <changaco ατ changaco δοτ net>
date Mon, 16 Apr 2012 01:59:19 +0200
parents 89f581ebf4b2
children ddbbd4ee5d47
files feed-push
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/feed-push
+++ b/feed-push
@@ -75,21 +75,21 @@ def ignore_event(path, event):
 
 def parse_config_file(config_fd):
     feeds_paths = config_to_feed_paths_to_commands[config_fd.name] = {}
-    cmd = None
-    next_cmd = []
+    cmd = []
     config_fd.seek(0)
     for i, line in enumerate(config_fd):
         line = line.strip()
         if len(line) == 0 or line[0] == '#':
             continue
         if line[0] == '%':
-            next_cmd.append(line[1:].rstrip(';'))
-        elif not next_cmd:
+            if isinstance(cmd, str):
+                cmd = []
+            cmd.append(line[1:].rstrip(';'))
+        elif not cmd:
             log(LOG_ERR, 'missing command in file '+config_fd.name+' before line '+str(i))
             return
         else:
-            cmd = '; '.join(next_cmd)
-            next_cmd = []
+            cmd = '; '.join(cmd)
             for feed_path in glob(line):
                 feed_path = abspath(feed_path)
                 dict_append(feeds_paths, feed_path, cmd)