f option is frozen with force_default_on_freeze property, owner must be 'default' check property when tried to change owner
This commit is contained in:
@ -22,7 +22,7 @@ from tiramisu.error import ConfigError, SlaveError, PropertiesOptionError
|
||||
from tiramisu.setting import owners, expires_time, undefined
|
||||
from tiramisu.autolib import carry_out_calculation
|
||||
from tiramisu.i18n import _
|
||||
from tiramisu.option import SymLinkOption, DynSymLinkOption
|
||||
from tiramisu.option import SymLinkOption, DynSymLinkOption, Option
|
||||
|
||||
|
||||
class Values(object):
|
||||
@ -350,11 +350,18 @@ class Values(object):
|
||||
|
||||
def _getowner(self, opt, path, validate_properties=True,
|
||||
force_permissive=False, validate_meta=True):
|
||||
if not isinstance(opt, Option) and not isinstance(opt, DynSymLinkOption):
|
||||
raise ConfigError(_('owner only avalaible for an option'))
|
||||
context = self._getcontext()
|
||||
setting = context.cfgimpl_get_settings()
|
||||
if 'frozen' in setting[opt] and \
|
||||
'force_default_on_freeze' in setting[opt]:
|
||||
return owners.default
|
||||
if validate_properties:
|
||||
self._getitem(opt, path, True, force_permissive, None, True)
|
||||
owner = self._p_.getowner(path, owners.default)
|
||||
if validate_meta:
|
||||
meta = self._getcontext().cfgimpl_get_meta()
|
||||
meta = context.cfgimpl_get_meta()
|
||||
if owner is owners.default and meta is not None:
|
||||
owner = meta.cfgimpl_get_values()._getowner(opt, path)
|
||||
return owner
|
||||
@ -376,6 +383,11 @@ class Values(object):
|
||||
if self._getowner(opt, path) == owners.default: # pragma: optional cover
|
||||
raise ConfigError(_('no value for {0} cannot change owner to {1}'
|
||||
'').format(path, owner))
|
||||
self._getcontext().cfgimpl_get_settings().validate_properties(opt,
|
||||
False,
|
||||
True,
|
||||
path)
|
||||
|
||||
self._p_.setowner(path, owner)
|
||||
|
||||
def is_default_owner(self, opt, validate_properties=True,
|
||||
|
Reference in New Issue
Block a user