changeset 23 | 9fa62cfd2821 |
parent 21 | 59540181a4bb |
parent 19 | 62ee928ac9b3 |
child 32 | 4059dbe9f26a |
--- a/ruleset.py Tue Apr 22 12:55:56 2008 +0100 +++ b/ruleset.py Tue Apr 22 13:03:17 2008 +0100 @@ -50,13 +50,20 @@ def __init__(self): self.rules = [] + self.preset = {} def add(self, action, conditions): self.rules.append((action, conditions)) + + def set(self, **kw): + self.preset.update(kw) + def matchrule(self, **kw): + d = self.preset.copy() + d.update(**kw) for a, c in self.rules: - if c(**kw): + if c(**d): return a return None @@ -78,5 +85,3 @@ finally: f.close() return res - -