quick fix which closes #0673348 - see comment for more info
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 12 Feb 2016 10:06:03 +0100
changeset 11107 df1f2d853d40
parent 11106 012e6c7d02ef
child 11108 c14087d08698
quick fix which closes #0673348 - see comment for more info
entities/adapters.py
--- a/entities/adapters.py	Fri Feb 12 10:39:24 2016 +0100
+++ b/entities/adapters.py	Fri Feb 12 10:06:03 2016 +0100
@@ -423,5 +423,9 @@
         else:
             assert 0
         key = rschema.type + '-subject'
-        msg, args = constraint.failed_message(key, self.entity.cw_edited[rschema.type])
+        # use .get since a constraint may be associated to an attribute that isn't edited (e.g.
+        # constraint between two attributes). This should be the purpose of an api rework at some
+        # point, we currently rely on the fact that such constraint will provide a dedicated user
+        # message not relying on the `value` argument
+        msg, args = constraint.failed_message(key, self.entity.cw_edited.get(rschema.type))
         raise ValidationError(self.entity.eid, {key: msg}, args)