server/repository.py
changeset 4843 5f7363416765
parent 4835 13b0b96d7982
child 4899 c666d265fb95
equal deleted inserted replaced
4835:13b0b96d7982 4843:5f7363416765
    85     # skip that for internal session or if integrity explicitly disabled
    85     # skip that for internal session or if integrity explicitly disabled
    86     #
    86     #
    87     # XXX we should imo rely on the orm to first fetch existing entity if any
    87     # XXX we should imo rely on the orm to first fetch existing entity if any
    88     # then delete it.
    88     # then delete it.
    89     if session.is_internal_session \
    89     if session.is_internal_session \
    90            or not session.is_hooks_category_activated('integrity'):
    90            or not session.is_hook_category_activated('integrity'):
    91         return
    91         return
    92     card = session.schema_rproperty(rtype, eidfrom, eidto, 'cardinality')
    92     card = session.schema_rproperty(rtype, eidfrom, eidto, 'cardinality')
    93     # one may be tented to check for neweids but this may cause more than one
    93     # one may be tented to check for neweids but this may cause more than one
    94     # relation even with '1?'  cardinality if thoses relations are added in the
    94     # relation even with '1?'  cardinality if thoses relations are added in the
    95     # same transaction where the entity is being created. This never occurs from
    95     # same transaction where the entity is being created. This never occurs from
   981         for attr in entity.keys():
   981         for attr in entity.keys():
   982             rschema = eschema.subjrels[attr]
   982             rschema = eschema.subjrels[attr]
   983             if not rschema.final: # inlined relation
   983             if not rschema.final: # inlined relation
   984                 relations.append((attr, entity[attr]))
   984                 relations.append((attr, entity[attr]))
   985         entity.set_defaults()
   985         entity.set_defaults()
   986         if session.is_hooks_category_activated('integrity'):
   986         if session.is_hook_category_activated('integrity'):
   987             entity.check(creation=True)
   987             entity.check(creation=True)
   988         source.add_entity(session, entity)
   988         source.add_entity(session, entity)
   989         if source.uri != 'system':
   989         if source.uri != 'system':
   990             extid = source.get_extid(entity)
   990             extid = source.get_extid(entity)
   991             self._extid_cache[(str(extid), source.uri)] = entity.eid
   991             self._extid_cache[(str(extid), source.uri)] = entity.eid
  1029         etype = str(entity.e_schema)
  1029         etype = str(entity.e_schema)
  1030         if server.DEBUG & server.DBG_REPO:
  1030         if server.DEBUG & server.DBG_REPO:
  1031             print 'UPDATE entity', etype, entity.eid, \
  1031             print 'UPDATE entity', etype, entity.eid, \
  1032                   dict(entity), edited_attributes
  1032                   dict(entity), edited_attributes
  1033         entity.edited_attributes = edited_attributes
  1033         entity.edited_attributes = edited_attributes
  1034         if session.is_hooks_category_activated('integrity'):
  1034         if session.is_hook_category_activated('integrity'):
  1035             entity.check()
  1035             entity.check()
  1036         eschema = entity.e_schema
  1036         eschema = entity.e_schema
  1037         session.set_entity_cache(entity)
  1037         session.set_entity_cache(entity)
  1038         only_inline_rels, need_fti_update = True, False
  1038         only_inline_rels, need_fti_update = True, False
  1039         relations = []
  1039         relations = []