hooks/integrity.py
changeset 5174 78438ad513ca
parent 5060 ee3b856e1406
child 5423 e15abfdcce38
equal deleted inserted replaced
5173:73760bbb66bd 5174:78438ad513ca
    75             # recheck pending eids / relation types
    75             # recheck pending eids / relation types
    76             if eid in pendingeids:
    76             if eid in pendingeids:
    77                 continue
    77                 continue
    78             if rtype in pendingrtypes:
    78             if rtype in pendingrtypes:
    79                 continue
    79                 continue
    80             if not session.execute(self.base_rql % rtype, {'x': eid}, 'x'):
    80             if not session.execute(self.base_rql % rtype, {'x': eid}):
    81                 etype = session.describe(eid)[0]
    81                 etype = session.describe(eid)[0]
    82                 _ = session._
    82                 _ = session._
    83                 msg = _('at least one relation %(rtype)s is required on '
    83                 msg = _('at least one relation %(rtype)s is required on '
    84                         '%(etype)s (%(eid)s)')
    84                         '%(etype)s (%(eid)s)')
    85                 msg %= {'rtype': _(rtype), 'etype': _(etype), 'eid': eid}
    85                 msg %= {'rtype': _(rtype), 'etype': _(etype), 'eid': eid}
   302         # of composite relation, we'll need a new operation
   302         # of composite relation, we'll need a new operation
   303         for eid, rtype in session.transaction_data.pop(self.key):
   303         for eid, rtype in session.transaction_data.pop(self.key):
   304             # don't do anything if the entity is being created or deleted
   304             # don't do anything if the entity is being created or deleted
   305             if not (eid in pendingeids or eid in neweids):
   305             if not (eid in pendingeids or eid in neweids):
   306                 etype = session.describe(eid)[0]
   306                 etype = session.describe(eid)[0]
   307                 session.execute(self.base_rql % (etype, rtype), {'x': eid}, 'x')
   307                 session.execute(self.base_rql % (etype, rtype), {'x': eid})
   308 
   308 
   309 class _DelayedDeleteSEntityOp(_DelayedDeleteOp):
   309 class _DelayedDeleteSEntityOp(_DelayedDeleteOp):
   310     """delete orphan subject entity of a composite relation"""
   310     """delete orphan subject entity of a composite relation"""
   311     key = '_cwiscomp'
   311     key = '_cwiscomp'
   312     base_rql = 'DELETE %s X WHERE X eid %%(x)s, NOT X %s Y'
   312     base_rql = 'DELETE %s X WHERE X eid %%(x)s, NOT X %s Y'