hooks/syncschema.py
changeset 4052 0c39ffd789ed
parent 4043 39ae94e0c8b8
child 4054 03c9a539d282
equal deleted inserted replaced
4051:eec34250a645 4052:0c39ffd789ed
  1068     def __call__(self):
  1068     def __call__(self):
  1069         if self._cw.deleted_in_transaction(self.eidfrom):
  1069         if self._cw.deleted_in_transaction(self.eidfrom):
  1070             return
  1070             return
  1071         schema = self._cw.vreg.schema
  1071         schema = self._cw.vreg.schema
  1072         entity = self._cw.entity_from_eid(self.eidto)
  1072         entity = self._cw.entity_from_eid(self.eidto)
  1073         subjtype, rtype, objtype = schema.schema_by_eid(self.eidfrom)
  1073         rdef = schema.schema_by_eid(self.eidfrom)
  1074         try:
  1074         try:
  1075             cstr = rtype.rdef(subjtype, objtype).constraint_by_type(
  1075             cstr = rdef.constraint_by_type(entity.type)
  1076                 entity.cstrtype[0].name)
       
  1077         except IndexError:
  1076         except IndexError:
  1078             self._cw.critical('constraint type no more accessible')
  1077             self._cw.critical('constraint type no more accessible')
  1079         else:
  1078         else:
       
  1079             subjtype, rtype, objtype = rdef.as_triple()
  1080             SourceDbCWConstraintDel(self._cw, subjtype=subjtype, rtype=rtype,
  1080             SourceDbCWConstraintDel(self._cw, subjtype=subjtype, rtype=rtype,
  1081                                     objtype=objtype, cstr=cstr)
  1081                                     objtype=objtype, cstr=cstr)
  1082             MemSchemaCWConstraintDel(self._cw, subjtype=subjtype, rtype=rtype,
  1082             MemSchemaCWConstraintDel(self._cw, subjtype=subjtype, rtype=rtype,
  1083                                      objtype=objtype, cstr=cstr)
  1083                                      objtype=objtype, cstr=cstr)
  1084 
  1084