# HG changeset patch # User Sylvain Thénault # Date 1453880548 -3600 # Node ID 1dad60d54dfbc2d385d82b06fd188ae7fd63b20d # Parent 891f3ecdbf7f6a44dd6108b7604308496c4f009a [dataimport] move eid attribution from the metagenerator back to the nohook store diff -r 891f3ecdbf7f -r 1dad60d54dfb cubicweb/dataimport/stores.py --- a/cubicweb/dataimport/stores.py Wed Jan 27 08:38:04 2016 +0100 +++ b/cubicweb/dataimport/stores.py Wed Jan 27 08:42:28 2016 +0100 @@ -159,6 +159,7 @@ super(NoHookRQLObjectStore, self).__init__(cnx) self.source = cnx.repo.system_source self._rschema = cnx.repo.schema.rschema + self._create_eid = cnx.repo.system_source.create_eid self._add_relation = self.source.add_relation if metagen is None: metagen = MetaGenerator(cnx) @@ -182,8 +183,9 @@ entity.cw_edited = copy(entity.cw_edited) entity.cw_clear_relation_cache() entity.cw_edited.update(kwargs, skipsec=False) + cnx = self._cnx + entity.eid = self._create_eid(cnx) entity_source, extid = self.metagen.init_entity(entity) - cnx = self._cnx self.source.add_info(cnx, entity, entity_source, extid) self.source.add_entity(cnx, entity) kwargs = dict() @@ -257,7 +259,6 @@ if source is None: source = cnx.repo.system_source self.source = source - self.create_eid = cnx.repo.system_source.create_eid self._now = datetime.utcnow() # attributes/relations shared by all entities of the same type self.etype_attrs = [] @@ -292,7 +293,6 @@ return entity, rels def init_entity(self, entity): - entity.eid = self.create_eid(self._cnx) # if cwuri is specified, this is an extid. It's not if it's generated in the above loop extid = entity.cw_edited.get('cwuri') if isinstance(extid, text_type):