[graph] Attribute: robust UIDs for list of elements as value

Fix variable UIDs for non-exclusive choices, which could be affected by different string encodings
This commit is contained in:
Yann Lanthony 2017-10-30 19:23:50 +01:00
parent 7e2d37c819
commit f1fdd34b6c

View file

@ -166,8 +166,9 @@ class Attribute(BaseObject):
return hash(self._invalidationValue)
if self.isLink:
return self.getLinkParam().uid()
if isinstance(self._value, basestring):
return hash(str(self._value))
if isinstance(self._value, (list, tuple, set,)):
# hash of sorted values hashed
return hash([hash(v) for v in sorted(self._value)])
return hash(self._value)
@property