diff options
-rw-r--r-- | RepSys/cgiutil.py | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/RepSys/cgiutil.py b/RepSys/cgiutil.py index ebb65c9..6dda91e 100644 --- a/RepSys/cgiutil.py +++ b/RepSys/cgiutil.py @@ -2,6 +2,7 @@ from RepSys import Error, config from RepSys.svn import SVN import time +import re class CgiError(Error): pass @@ -19,24 +20,22 @@ def get_targets(): if not TARGETS: target = SubmitTarget() targetoptions = {} - for option, value in config.walk("submit"): - if targetoptions.has_key(option): - TARGETS.append(target) + submit_re = re.compile("^submit\s+(.+)$") + for section in config.sections(): + m = submit_re.match(section) + if m: target = SubmitTarget() - targetoptions = {} - targetoptions[option] = 1 - if option == "name": - target.name = value - elif option == "target": - target.target = value.split() - elif option == "allowed": - target.allowed = value.split() - elif option == "scripts": - target.scripts = value.split() - else: - raise Error, "unknown [submit] option %s" % option - if targetoptions: - TARGETS.append(target) + target.name = m.group(1) + for option, value in config.walk(section): + if option == "target": + target.target = value.split() + elif option == "allowed": + target.allowed = value.split() + elif option == "scripts": + target.scripts = value.split() + else: + raise Error, "unknown [%s] option %s" % (section, option) + TARGETS.append(target) return TARGETS # vim:et:ts=4:sw=4 |