[attributs] On affiche le nom de l'attribut quand on lève une SingleValueError

This commit is contained in:
Valentin Samir 2013-05-14 23:31:48 +02:00
parent be97406333
commit 92c4dedfb3

View file

@ -124,7 +124,7 @@ class AttrsDict(dict):
values = [ values ]
if self._parent.mode in ['w', 'rw']:
if CRANS_ATTRIBUTES.get(attr, Attr).singlevalue and len(values) > 1:
raise SingleValueError("L'attribut %s doit être monovalué.")
raise SingleValueError("L'attribut %s doit être monovalué." % CRANS_ATTRIBUTES.get(attr, Attr).__name__)
super(AttrsDict, self).__setitem__(attr, values)
else:
super(AttrsDict, self).__setitem__(attr, values)