This commit is contained in:
Emmanuel Garette 2018-03-12 11:58:49 +01:00
parent 163b554ee9
commit 0d5c1c32ca
5 changed files with 18 additions and 13 deletions

View File

@ -146,7 +146,7 @@ def test_setowner_symlinkoption():
assert api.option('tiramisu.symdummy').owner.isdefault()
api.option('tiramisu.dummy').value.set(True)
assert not api.option('tiramisu.symdummy').owner.isdefault()
raises(TypeError, "api.option('tiramisu.symdummy').owner.set('user')")
raises(ConfigError, "api.option('tiramisu.symdummy').owner.set('user')")
def test_owner_masterslaves():

View File

@ -380,13 +380,18 @@ class TiramisuOptionPermissive(CommonTiramisuOption):
@count
def set(self, permissives):
if TIRAMISU_VERSION == 2:
permissive = tuple(permissives)
permissives = tuple(permissives)
path = self._path
opt = self._opt
self.settings.setpermissive(opt=opt,
path=path,
permissive=permissives)
else:
path = self.path
self.settings.setpermissive(opt=self._opt,
opt = self._get_option()
self.settings.setpermissive(opt=opt,
path=path,
permissive=permissive)
permissives=permissives)
@count
def reset(self, path):

View File

@ -236,8 +236,8 @@ class SubConfig(object):
nconfig_bag = config_bag.copy('nooption')
nconfig_bag.option = opt
name = opt.impl_getname()
subpath = self._get_subpath(name)
if nconfig_bag.setting_properties is not None:
subpath = self._get_subpath(name)
try:
context.cfgimpl_get_settings().validate_properties(subpath,
None,

View File

@ -447,7 +447,7 @@ class OptionDescription(OptionDescriptionWalk):
"""
if not isinstance(children, list):
raise ValueError(_('children in optiondescription "{}" must be a list').format(name))
super(OptionDescription, self).__init__(name,
super().__init__(name,
doc=doc,
requires=requires,
properties=properties)

View File

@ -531,10 +531,10 @@ class Values(object):
"""
opt = config_bag.option
if opt.impl_is_symlinkoption():
raise TypeError(_("can't set owner for the SymLinkOption \"{}\""
raise ConfigError(_("can't set owner for the SymLinkOption \"{}\""
"").format(opt.impl_get_display_name()))
if not isinstance(owner, owners.Owner):
raise TypeError(_("invalid owner {0}").format(str(owner)))
raise ConfigError(_("invalid owner {0}").format(str(owner)))
if owner in forbidden_owners:
raise ConfigError(_('set owner "{0}" is forbidden').format(str(owner)))