server/repository.py
branchstable
changeset 7502 e7190f7e850e
parent 7501 2983dd24494a
child 7503 bc30c2faaadc
--- a/server/repository.py	Tue Jun 14 15:37:09 2011 +0200
+++ b/server/repository.py	Tue Jun 14 15:37:09 2011 +0200
@@ -103,7 +103,8 @@
     if session.is_internal_session \
            or not session.is_hook_category_activated('activeintegrity'):
         return
-    card = session.schema_rproperty(rtype, eidfrom, eidto, 'cardinality')
+    rdef = session.rtype_eids_rdef(rtype, eidfrom, eidto)
+    card = rdef.cardinality
     # one may be tented to check for neweids but this may cause more than one
     # relation even with '1?'  cardinality if thoses relations are added in the
     # same transaction where the entity is being created. This never occurs from
@@ -115,7 +116,7 @@
     # * inlined relations will be implicitly deleted for the subject entity
     # * we don't want read permissions to be applied but we want delete
     #   permission to be checked
-    if card[0] in '1?' and not session.repo.schema.rschema(rtype).inlined:
+    if card[0] in '1?' and not rdef.rtype.inlined:
         with security_enabled(session, read=False):
             session.execute('DELETE X %s Y WHERE X eid %%(x)s, '
                             'NOT Y eid %%(y)s' % rtype,