diff -r db81a99e9dd1 -r 661dd0436c01 cubicweb/schema.py --- a/cubicweb/schema.py Wed Mar 13 10:21:39 2019 +0100 +++ b/cubicweb/schema.py Mon Mar 11 17:43:23 2019 +0100 @@ -1177,14 +1177,13 @@ # additional cw specific constraints ########################################### -@monkeypatch(BaseConstraint) -def name_for(self, rdef): +def constraint_name_for(constraint, rdef): """Return a unique, size controlled, name for this constraint applied to given `rdef`. This name may be used as name for the constraint in the database. """ - return 'cstr' + md5((rdef.subject.type + rdef.rtype.type + self.type() - + (self.serialize() or '')).encode('ascii')).hexdigest() + return 'cstr' + md5((rdef.subject.type + rdef.rtype.type + constraint.type() + + (constraint.serialize() or '')).encode('ascii')).hexdigest() class BaseRQLConstraint(RRQLExpression, BaseConstraint):