equal
deleted
inserted
replaced
188 # every schema operation is triggering a schema update |
188 # every schema operation is triggering a schema update |
189 MemSchemaNotifyChanges(session) |
189 MemSchemaNotifyChanges(session) |
190 |
190 |
191 def prepare_constraints(self, rdef): |
191 def prepare_constraints(self, rdef): |
192 # if constraints is already a list, reuse it (we're updating multiple |
192 # if constraints is already a list, reuse it (we're updating multiple |
193 # constraints of the same rdef in the same transactions |
193 # constraints of the same rdef in the same transactions) |
194 if not isinstance(rdef.constraints, list): |
194 if not isinstance(rdef.constraints, list): |
195 rdef.constraints = list(rdef.constraints) |
195 rdef.constraints = list(rdef.constraints) |
196 self.constraints = rdef.constraints |
196 self.constraints = rdef.constraints |
197 |
197 |
198 |
198 |
671 if self.session.added_in_transaction(rdef.eid): |
671 if self.session.added_in_transaction(rdef.eid): |
672 self.cancelled = True |
672 self.cancelled = True |
673 return |
673 return |
674 rdef = self.session.vreg.schema.schema_by_eid(rdef.eid) |
674 rdef = self.session.vreg.schema.schema_by_eid(rdef.eid) |
675 self.prepare_constraints(rdef) |
675 self.prepare_constraints(rdef) |
676 subjtype, rtype, objtype = rdef.as_triple() |
|
677 cstrtype = self.entity.type |
676 cstrtype = self.entity.type |
678 self.cstr = rtype.rdef(subjtype, objtype).constraint_by_type(cstrtype) |
677 self.cstr = rdef.constraint_by_type(cstrtype) |
679 self.newcstr = CONSTRAINTS[cstrtype].deserialize(self.entity.value) |
678 self.newcstr = CONSTRAINTS[cstrtype].deserialize(self.entity.value) |
680 self.newcstr.eid = self.entity.eid |
679 self.newcstr.eid = self.entity.eid |
681 |
680 |
682 def commit_event(self): |
681 def commit_event(self): |
683 if self.cancelled: |
682 if self.cancelled: |