311 def cardinalitycheck_before_del_relation(session, eidfrom, rtype, eidto): |
311 def cardinalitycheck_before_del_relation(session, eidfrom, rtype, eidto): |
312 """check cardinalities are satisfied""" |
312 """check cardinalities are satisfied""" |
313 if rtype in DONT_CHECK_RTYPES_ON_DEL: |
313 if rtype in DONT_CHECK_RTYPES_ON_DEL: |
314 return |
314 return |
315 card = rproperty(session, rtype, eidfrom, eidto, 'cardinality') |
315 card = rproperty(session, rtype, eidfrom, eidto, 'cardinality') |
|
316 pendingrdefs = session.transaction_data.get('pendingrdefs', ()) |
|
317 if (session.describe(eidfrom)[0], rtype, session.describe(eidto)[0]) in pendingrdefs: |
|
318 return |
316 pendingeids = session.transaction_data.get('pendingeids', ()) |
319 pendingeids = session.transaction_data.get('pendingeids', ()) |
317 if card[0] in '1+' and not eidfrom in pendingeids: |
320 if card[0] in '1+' and not eidfrom in pendingeids: |
318 checkrel_if_necessary(session, CheckSRelationOp, rtype, eidfrom) |
321 checkrel_if_necessary(session, CheckSRelationOp, rtype, eidfrom) |
319 if card[1] in '1+' and not eidto in pendingeids: |
322 if card[1] in '1+' and not eidto in pendingeids: |
320 checkrel_if_necessary(session, CheckORelationOp, rtype, eidto) |
323 checkrel_if_necessary(session, CheckORelationOp, rtype, eidto) |