873 reset_pool = True |
873 reset_pool = True |
874 eid = self.system_source.extid2eid(session, source, extid) |
874 eid = self.system_source.extid2eid(session, source, extid) |
875 if eid is not None: |
875 if eid is not None: |
876 self._extid_cache[cachekey] = eid |
876 self._extid_cache[cachekey] = eid |
877 self._type_source_cache[eid] = (etype, source.uri, extid) |
877 self._type_source_cache[eid] = (etype, source.uri, extid) |
|
878 # XXX used with extlite (eg vcsfile), probably not needed anymore |
878 if recreate: |
879 if recreate: |
879 entity = source.before_entity_insertion(session, extid, etype, eid) |
880 entity = source.before_entity_insertion(session, extid, etype, eid) |
880 entity._cw_recreating = True |
881 entity._cw_recreating = True |
881 if source.should_call_hooks: |
882 if source.should_call_hooks: |
882 self.hm.call_hooks('before_add_entity', session, entity=entity) |
883 self.hm.call_hooks('before_add_entity', session, entity=entity) |
901 try: |
902 try: |
902 eid = self.system_source.create_eid(session) |
903 eid = self.system_source.create_eid(session) |
903 self._extid_cache[cachekey] = eid |
904 self._extid_cache[cachekey] = eid |
904 self._type_source_cache[eid] = (etype, source.uri, extid) |
905 self._type_source_cache[eid] = (etype, source.uri, extid) |
905 entity = source.before_entity_insertion(session, extid, etype, eid) |
906 entity = source.before_entity_insertion(session, extid, etype, eid) |
906 if not hasattr(entity, 'edited_attributes'): |
907 entity.edited_attributes = set(entity) |
907 entity.edited_attributes = set() |
|
908 if source.should_call_hooks: |
908 if source.should_call_hooks: |
909 entity.edited_attributes = set(entity) |
|
910 self.hm.call_hooks('before_add_entity', session, entity=entity) |
909 self.hm.call_hooks('before_add_entity', session, entity=entity) |
911 # XXX call add_info with complete=False ? |
910 # XXX call add_info with complete=False ? |
912 self.add_info(session, entity, source, extid) |
911 self.add_info(session, entity, source, extid) |
913 source.after_entity_insertion(session, extid, entity) |
912 source.after_entity_insertion(session, extid, entity) |
914 if source.should_call_hooks: |
913 if source.should_call_hooks: |