# HG changeset patch # User Oleg Oshmyan # Date 1313532306 -10800 # Node ID 32650f4a2177ed81d256d0e844a00add9bd6b686 # Parent fa81289ee4078feb68a37dea39bd8399b0c0dd7a 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. diff -r fa81289ee407 -r 32650f4a2177 upreckon/config.py --- 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: