From acabf3f5e1f0e0107c3caba55fa822f49ee79bf1 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 18 Oct 2006 14:51:53 +0000 Subject: use a different "submit " section per target in configuration file --- RepSys/cgiutil.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'RepSys/cgiutil.py') 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 -- cgit v1.2.1