better error message with requirementerror

This commit is contained in:
2017-05-05 21:44:47 +02:00
parent 1ee7d500dd
commit b4cab93e85
3 changed files with 64 additions and 53 deletions

View File

@ -673,12 +673,16 @@ class Settings(object):
continue
properties = value.proptype
if same_action and action not in properties: # pragma: optional cover
raise RequirementError(_("option '{0}' has "
"requirement's property "
"error: "
"{1} {2}").format(opt._name,
reqpath,
properties))
if len(properties) == 1:
prop_msg = _('property')
else:
prop_msg = _('properties')
raise RequirementError(_('cannot access to option "{0}" because '
'required option "{1}" has {2} {3}'
'').format(opt.impl_get_display_name(),
option.impl_get_display_name(),
prop_msg,
display_list(properties)))
orig_value = value
# transitive action, force expected
value = expected[0]