display_name could be not unique
authorEmmanuel Garette <egarette@cadoles.com>
Mon, 21 Nov 2016 17:49:04 +0000 (18:49 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Mon, 21 Nov 2016 17:49:04 +0000 (18:49 +0100)
tiramisu/option/baseoption.py

index 95cf9bf..091d46a 100644 (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):