This commit is contained in:
Emmanuel Garette 2013-08-20 16:48:19 +02:00
parent 2e8c75a602
commit d971448d02
1 changed files with 9 additions and 8 deletions

View File

@ -314,13 +314,13 @@ class Settings(object):
raise PropertiesOptionError(_('cannot change the value for ' raise PropertiesOptionError(_('cannot change the value for '
'option {0} this option is' 'option {0} this option is'
' frozen').format( ' frozen').format(
opt_or_descr._name), opt_or_descr._name),
props) props)
else: else:
raise PropertiesOptionError(_("trying to access to an option " raise PropertiesOptionError(_("trying to access to an option "
"named: {0} with properties {1}" "named: {0} with properties {1}"
"").format(opt_or_descr._name, "").format(opt_or_descr._name,
str(props)), props) str(props)), props)
#FIXME should be setpermissive #FIXME should be setpermissive
def set_permissive(self, permissive, opt=None): def set_permissive(self, permissive, opt=None):
@ -372,12 +372,13 @@ class Settings(object):
matches = False matches = False
for require in requires: for require in requires:
option, expected, action, inverse, \ option, expected, action, inverse, \
transitive, same_action = require transitive, same_action = require
path = descr.impl_get_path_by_opt(option) path = descr.impl_get_path_by_opt(option)
if path == optpath or path.startswith(optpath + '.'): if path == optpath or path.startswith(optpath + '.'):
raise RequirementError(_("malformed requirements " raise RequirementError(_("malformed requirements "
"imbrication detected for option: '{0}' " "imbrication detected for option:"
"with requirement on: '{1}'").format(optpath, path)) " '{0}' with requirement on: "
"'{1}'").format(optpath, path))
try: try:
value = self.context._getattr(path, force_permissive=True) value = self.context._getattr(path, force_permissive=True)
except PropertiesOptionError, err: except PropertiesOptionError, err:
@ -398,8 +399,8 @@ class Settings(object):
raise AttributeError(_("required option not found: " raise AttributeError(_("required option not found: "
"{0}").format(path)) "{0}").format(path))
if (not inverse and if (not inverse and
value in expected or value in expected or
inverse and value not in expected): inverse and value not in expected):
matches = True matches = True
setting.append(action) setting.append(action)
## the calculation cannot be carried out ## the calculation cannot be carried out