Mercurial > ~astiob > upreckon > hgweb
changeset 201:32650f4a2177
taskweight can now be an iterable or a mapping
If an iterable, its items correspond to items of the problems
configuration variable. If a mapping, its keys are problem
names.
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Wed, 17 Aug 2011 01:05:06 +0300 |
parents | fa81289ee407 |
children | d46bb4495766 |
files | upreckon/config.py |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/upreckon/config.py Wed Aug 17 00:32:01 2011 +0300 +++ b/upreckon/config.py Wed Aug 17 01:05:06 2011 +0300 @@ -177,6 +177,16 @@ elif not callable(module.tester): tester = tuple(module.tester) module.tester = (nativize_path(tester[0]),) + tester[1:] + try: + module.taskweight = dict(zip(module.problems, module.taskweight)) + except TypeError: + pass + try: + module.taskweight = module.taskweight[problem_name] + except KeyError: + module.taskweight = defaults_problem['taskweight'] + except TypeError: + pass for name in 'pointmap', 'groupweight': oldmap = getattr(module, name) if isinstance(oldmap, dict): @@ -243,6 +253,11 @@ setattr(module, name, getattr(module, name, defaults_noerase[name])) if hasattr(module, 'tasknames'): module.problems = module.tasknames + # Iterable and mapping taskweights cause re-iteration over problems + try: + len(module.problems) + except Exception: + module.problems = tuple(module.problems) global globalconf globalconf = module try: