equal
deleted
inserted
replaced
631 |
631 |
632 |
632 |
633 def _set_modifiable_constraints(rdef): |
633 def _set_modifiable_constraints(rdef): |
634 # for proper in-place modification of in-memory schema: if rdef.constraints |
634 # for proper in-place modification of in-memory schema: if rdef.constraints |
635 # is already a list, reuse it (we're updating multiple constraints of the |
635 # is already a list, reuse it (we're updating multiple constraints of the |
636 # same rdef in the same transactions) |
636 # same rdef in the same transaction) |
637 if not isinstance(rdef.constraints, list): |
637 if not isinstance(rdef.constraints, list): |
638 rdef.constraints = list(rdef.constraints) |
638 rdef.constraints = list(rdef.constraints) |
639 |
639 |
640 |
640 |
641 class CWConstraintDelOp(MemSchemaOperation): |
641 class CWConstraintDelOp(MemSchemaOperation): |
1135 schema = self._cw.vreg.schema |
1135 schema = self._cw.vreg.schema |
1136 try: |
1136 try: |
1137 # KeyError, e.g. composite chain deletion |
1137 # KeyError, e.g. composite chain deletion |
1138 rdef = schema.schema_by_eid(entity.reverse_constrained_by[0].eid) |
1138 rdef = schema.schema_by_eid(entity.reverse_constrained_by[0].eid) |
1139 # IndexError |
1139 # IndexError |
1140 cstr = rdef.constraint_by_type(entity.type) |
1140 cstr = rdef.constraint_by_eid(entity.eid) |
1141 except (KeyError, IndexError): |
1141 except (KeyError, IndexError): |
1142 self._cw.critical('constraint type no more accessible') |
1142 self._cw.critical('constraint type no more accessible') |
1143 else: |
1143 else: |
1144 CWConstraintDelOp(self._cw, rdef=rdef, oldcstr=cstr) |
1144 CWConstraintDelOp(self._cw, rdef=rdef, oldcstr=cstr) |
1145 |
1145 |