hooks/integrity.py
changeset 4027 02273e65e1c2
parent 4024 6a14cff373c3
child 4075 e710f4052bd6
equal deleted inserted replaced
4026:d80a55a024d8 4027:02273e65e1c2
    65     __abstract__ = True
    65     __abstract__ = True
    66     category = 'integrity'
    66     category = 'integrity'
    67 
    67 
    68 class UserIntegrityHook(IntegrityHook):
    68 class UserIntegrityHook(IntegrityHook):
    69     __abstract__ = True
    69     __abstract__ = True
    70     __select__ = IntegrityHook.__select__ & ~hook.regular_session()
    70     __select__ = IntegrityHook.__select__ & hook.regular_session()
    71 
    71 
    72 
    72 
    73 class CheckCardinalityHook(UserIntegrityHook):
    73 class CheckCardinalityHook(UserIntegrityHook):
    74     """check cardinalities are satisfied"""
    74     """check cardinalities are satisfied"""
    75     __regid__ = 'checkcard'
    75     __regid__ = 'checkcard'
   150         constraints = self._cw.schema_rproperty(self.rtype, self.eidfrom, self.eidto,
   150         constraints = self._cw.schema_rproperty(self.rtype, self.eidfrom, self.eidto,
   151                                                 'constraints')
   151                                                 'constraints')
   152         if constraints:
   152         if constraints:
   153             _CheckConstraintsOp(self._cw, constraints=constraints,
   153             _CheckConstraintsOp(self._cw, constraints=constraints,
   154                                rdef=(self.eidfrom, self.rtype, self.eidto))
   154                                rdef=(self.eidfrom, self.rtype, self.eidto))
       
   155 
   155 
   156 
   156 class CheckAttributeConstraintHook(UserIntegrityHook):
   157 class CheckAttributeConstraintHook(UserIntegrityHook):
   157     """check the attribute relation satisfy its constraints
   158     """check the attribute relation satisfy its constraints
   158 
   159 
   159     this is delayed to a precommit time operation since other relation which
   160     this is delayed to a precommit time operation since other relation which