[Anygui-checkins] CVS: anygui/lib/anygui Rules.py,1.16,1.17
Brought to you by:
mlh
From: Magnus L. H. <ml...@us...> - 2002-04-19 15:38:16
|
Update of /cvsroot/anygui/anygui/lib/anygui In directory usw-pr-cvs1:/tmp/cvs-serv25873/lib/anygui Modified Files: Rules.py Log Message: Index: Rules.py =================================================================== RCS file: /cvsroot/anygui/anygui/lib/anygui/Rules.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** Rules.py 17 Apr 2002 17:46:59 -0000 1.16 --- Rules.py 19 Apr 2002 15:23:34 -0000 1.17 *************** *** 1,6 **** ! # TODO: ! # - Add total consistency check (when supplied with no relevant defs) ! # - Add consistency check for ordinary updates def addSubKey(dict, key, subkey): --- 1,4 ---- ! class IllegalState(Exception): pass def addSubKey(dict, key, subkey): *************** *** 43,48 **** def check(self, state): ! # Check that no rules cause any change... ! pass def sync(self, state, defs): --- 41,50 ---- def check(self, state): ! names = self.parts.copy() ! names.update(self.whole) ! names = names.keys() ! for name in names: ! if not state[name] == self.newValue(name, state, {}): ! raise IllegalState('inconsistent attribute values') def sync(self, state, defs): *************** *** 52,58 **** undef.update(self.getParents(name)) undef.update(self.getSpouses(name)) ! if not undef: # Is this correct? self.check(state) - return stable = 0 while undef and not stable: --- 54,59 ---- undef.update(self.getParents(name)) undef.update(self.getSpouses(name)) ! if not undef: self.check(state) stable = 0 while undef and not stable: *************** *** 60,64 **** for name in undef.keys(): newValue = self.newValue(name, state, undef) ! if newValue is not None: state[name] = newValue del undef[name] --- 61,65 ---- for name in undef.keys(): newValue = self.newValue(name, state, undef) ! if newValue is not None: # FIXME: None is not safe here; use exception state[name] = newValue del undef[name] |