if consistency with multiple option return if transitive

This commit is contained in:
Emmanuel Garette 2014-12-01 23:02:55 +01:00
parent 7646071efd
commit 71e69cd0bf
3 changed files with 21 additions and 1 deletions

View file

@ -1,6 +1,7 @@
Mon Dec 1 22:58:13 2014 +0200 Emmanuel Garette <egarette@cadoles.com>
* propertyerror are transitive in consistency, now it's possible to set
non-transitive consistency
* if consistency with multiple option return if transitive
Sun Oct 26 08:50:38 2014 +0200 Emmanuel Garette <egarette@cadoles.com>
* if option is frozen with force_default_on_freeze property, owner

View file

@ -419,6 +419,25 @@ def test_consistency_disabled_transitive():
c.a = 1
def test_consistency_disabled_transitive_2():
a = IPOption('a', '')
b = IPOption('b', '')
c = NetworkOption('c', '', default='192.168.1.0')
d = NetmaskOption('d', '', default='255.255.255.0', properties=('disabled',))
od = OptionDescription('od', '', [a, b, c, d])
a.impl_add_consistency('not_equal', b)
a.impl_add_consistency('in_network', c, d, transitive=False)
c = Config(od)
c.read_write()
c.a = '192.168.1.1'
raises(ValueError, "c.b = '192.168.1.1'")
c.a = '192.168.2.1'
#
c.a = '192.168.1.1'
c.cfgimpl_get_settings().remove('disabled')
raises(ValueError, "c.a = '192.168.2.1'")
def return_val(*args, **kwargs):
return '192.168.1.1'

View file

@ -469,7 +469,7 @@ class Option(OnlyOption):
if transitive:
raise err
else:
pass
return
getattr(self, func)(all_cons_opts, all_cons_vals, warnings_only)
def impl_validate(self, value, context=undefined, validate=True,