cubicweb/entities/adapters.py
changeset 11129 97095348b3ee
parent 11107 df1f2d853d40
parent 11057 0b59724cb3f2
child 11358 179b5ff3f428
--- a/cubicweb/entities/adapters.py	Thu Feb 11 21:59:49 2016 +0100
+++ b/cubicweb/entities/adapters.py	Wed Feb 17 13:45:34 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)