remove slave values when delete a master without value

This commit is contained in:
2015-04-19 09:37:46 +02:00
parent 6fc921fc19
commit 2c6275ffbd
3 changed files with 70 additions and 12 deletions

View File

@ -158,18 +158,21 @@ class Values(object):
if validate:
context.cfgimpl_get_settings().validate_properties(opt, False,
True, path)
if self._contains(path):
if validate:
setting = context.cfgimpl_get_settings()
fake_context = context._gen_fake_values()
setting_properties = setting._getproperties()
fake_value = fake_context.cfgimpl_get_values()
fake_value.reset(opt, path, validate=False)
opt.impl_validate(getattr(fake_context, path),
fake_context, 'validator' in setting_properties)
context.cfgimpl_reset_cache()
if opt.impl_is_master_slaves('master'):
opt.impl_get_master_slaves().reset(opt, self)
hasvalue = self._contains(path)
if hasvalue and validate:
setting = context.cfgimpl_get_settings()
fake_context = context._gen_fake_values()
setting_properties = setting._getproperties()
fake_value = fake_context.cfgimpl_get_values()
fake_value.reset(opt, path, validate=False)
opt.impl_validate(getattr(fake_context, path),
fake_context, 'validator' in setting_properties)
context.cfgimpl_reset_cache()
if opt.impl_is_master_slaves('master'):
opt.impl_get_master_slaves().reset(opt, self)
if hasvalue:
self._p_.resetvalue(path)
def _isempty(self, opt, value):