server/repository.py
changeset 4467 0e73d299730a
parent 4252 6c4f109c2b03
child 4517 0f3c10fc42b2
equal deleted inserted replaced
4466:8b0ca7904820 4467:0e73d299730a
  1127             del_existing_rel_if_needed(session, subject, rtype, object)
  1127             del_existing_rel_if_needed(session, subject, rtype, object)
  1128             self.hm.call_hooks('before_add_relation', session,
  1128             self.hm.call_hooks('before_add_relation', session,
  1129                                eidfrom=subject, rtype=rtype, eidto=object)
  1129                                eidfrom=subject, rtype=rtype, eidto=object)
  1130         source.add_relation(session, subject, rtype, object)
  1130         source.add_relation(session, subject, rtype, object)
  1131         rschema = self.schema.rschema(rtype)
  1131         rschema = self.schema.rschema(rtype)
  1132         session.update_rel_cache_add(subject, rtype, object, rschema.symetric)
  1132         session.update_rel_cache_add(subject, rtype, object, rschema.symmetric)
  1133         if source.should_call_hooks:
  1133         if source.should_call_hooks:
  1134             self.hm.call_hooks('after_add_relation', session,
  1134             self.hm.call_hooks('after_add_relation', session,
  1135                                eidfrom=subject, rtype=rtype, eidto=object)
  1135                                eidfrom=subject, rtype=rtype, eidto=object)
  1136 
  1136 
  1137     def glob_delete_relation(self, session, subject, rtype, object):
  1137     def glob_delete_relation(self, session, subject, rtype, object):
  1142         if source.should_call_hooks:
  1142         if source.should_call_hooks:
  1143             self.hm.call_hooks('before_delete_relation', session,
  1143             self.hm.call_hooks('before_delete_relation', session,
  1144                                eidfrom=subject, rtype=rtype, eidto=object)
  1144                                eidfrom=subject, rtype=rtype, eidto=object)
  1145         source.delete_relation(session, subject, rtype, object)
  1145         source.delete_relation(session, subject, rtype, object)
  1146         rschema = self.schema.rschema(rtype)
  1146         rschema = self.schema.rschema(rtype)
  1147         session.update_rel_cache_del(subject, rtype, object, rschema.symetric)
  1147         session.update_rel_cache_del(subject, rtype, object, rschema.symmetric)
  1148         if rschema.symetric:
  1148         if rschema.symmetric:
  1149             # on symetric relation, we can't now in which sense it's
  1149             # on symmetric relation, we can't now in which sense it's
  1150             # stored so try to delete both
  1150             # stored so try to delete both
  1151             source.delete_relation(session, object, rtype, subject)
  1151             source.delete_relation(session, object, rtype, subject)
  1152         if source.should_call_hooks:
  1152         if source.should_call_hooks:
  1153             self.hm.call_hooks('after_delete_relation', session,
  1153             self.hm.call_hooks('after_delete_relation', session,
  1154                                eidfrom=subject, rtype=rtype, eidto=object)
  1154                                eidfrom=subject, rtype=rtype, eidto=object)