[dataimport] move eid attribution from the metagenerator back to the nohook store
--- 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):