display_name could be not unique

This commit is contained in:
Emmanuel Garette 2016-11-21 18:49:04 +01:00
parent db517a8117
commit 05200b6d5c

View File

@ -797,23 +797,25 @@ class Option(OnlyOption):
for opt_ in [opts[idx_inf], opts[idx_inf + idx_sup + 1]]:
if opt_ == current_opt:
is_current = True
equal.add('"{}"'.format(opt_.impl_get_display_name()))
else:
equal.add(opt_)
if equal:
if debug:
log.debug(_('_cons_not_equal: {} are not different').format(display_list(list(equal))))
if is_current:
equal.remove('"' + current_opt.impl_get_display_name() + '"')
if warnings_only:
msg = _('should be different from the value of {}')
else:
msg = _('must be different from the value of {}')
return ValueError(msg.format(display_list(list(equal))))
else:
if warnings_only:
msg = _('value for {} should be different')
else:
msg = _('value for {} must be different')
return ValueError(msg.format(display_list(list(equal))))
equal_name = []
for opt in equal:
equal_name.append(opt.impl_get_display_name())
return ValueError(msg.format(display_list(list(equal_name))))
# serialize/unserialize
def _impl_convert_consistencies(self, descr, load=False):