equal
deleted
inserted
replaced
19 framework itself. |
19 framework itself. |
20 """ |
20 """ |
21 from cubicweb import _ |
21 from cubicweb import _ |
22 |
22 |
23 from itertools import chain |
23 from itertools import chain |
24 from hashlib import md5 |
|
25 |
24 |
26 from logilab.mtconverter import TransformError |
25 from logilab.mtconverter import TransformError |
27 from logilab.common.decorators import cached |
26 from logilab.common.decorators import cached |
28 |
27 |
29 from cubicweb import ValidationError, view, ViolatedConstraint, UniqueTogetherError |
28 from cubicweb import ValidationError, view, ViolatedConstraint, UniqueTogetherError |
411 cstrname = self.exc.cstrname |
410 cstrname = self.exc.cstrname |
412 eschema = self.entity.e_schema |
411 eschema = self.entity.e_schema |
413 for rschema, attrschema in eschema.attribute_definitions(): |
412 for rschema, attrschema in eschema.attribute_definitions(): |
414 rdef = rschema.rdef(eschema, attrschema) |
413 rdef = rschema.rdef(eschema, attrschema) |
415 for constraint in rdef.constraints: |
414 for constraint in rdef.constraints: |
416 if cstrname == 'cstr' + md5( |
415 if cstrname == constraint.name_for(rdef): |
417 (eschema.type + rschema.type + constraint.type() + |
|
418 (constraint.serialize() or '')).encode('ascii')).hexdigest(): |
|
419 break |
416 break |
420 else: |
417 else: |
421 continue |
418 continue |
422 break |
419 break |
423 else: |
420 else: |