[PATCH 2 of 5 saem_ref v2] Adapt usage of dataimport store factories to recent cubicweb-skos changes

Denis Laxalde denis.laxalde at logilab.fr
Mon Jan 8 15:05:58 CET 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1515411473 -3600
#      Mon Jan 08 12:37:53 2018 +0100
# Node ID 0588fea254945d68fdbba019702f0764f536fa0f
# Parent  0140f2679535d889a3919194ba9253962cf83648
# EXP-Topic lcsv-skos-import
Adapt usage of dataimport store factories to recent cubicweb-skos changes

Factory functions now require a "config" argument.

diff --git a/cubicweb_saem_ref/__init__.py b/cubicweb_saem_ref/__init__.py
--- a/cubicweb_saem_ref/__init__.py
+++ b/cubicweb_saem_ref/__init__.py
@@ -66,13 +66,13 @@ def includeme(config):
     config.include('.pviews')
 
 
-def _massive_store_factory(cnx, **kwargs):
+def _massive_store_factory(cnx, config, **kwargs):
     from cubicweb.dataimport.massive_store import MassiveObjectStore
     from .sobjects import SAEMMetadataGenerator
     return MassiveObjectStore(cnx, metagen=SAEMMetadataGenerator(cnx), **kwargs)
 
 
-def _nohook_store_factory(cnx):
+def _nohook_store_factory(cnx, config):
     from cubicweb.dataimport.stores import NoHookRQLObjectStore
     from .sobjects import SAEMMetadataGenerator
     return NoHookRQLObjectStore(cnx, metagen=SAEMMetadataGenerator(cnx))
diff --git a/cubicweb_saem_ref/ccplugin.py b/cubicweb_saem_ref/ccplugin.py
--- a/cubicweb_saem_ref/ccplugin.py
+++ b/cubicweb_saem_ref/ccplugin.py
@@ -102,10 +102,10 @@ def run(self, args):
 
             print('\n%s' % underline_title('Importing EAC files'))
             if cnx.repo.system_source.dbdriver == 'postgres':
-                store = _massive_store_factory(cnx, eids_seq_range=100)
+                store = _massive_store_factory(cnx, self.config, eids_seq_range=100)
                 store.metagen.naa_what = org.ark_naa[0].what
             else:
-                store = _nohook_store_factory(cnx)
+                store = _nohook_store_factory(cnx, self.config)
             eac.eac_import_files(cnx, args[1:], authority=org, store=store)
     finally:
         if repo is not None:
diff --git a/dev-requirements.txt b/dev-requirements.txt
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,3 +1,4 @@
 mock
 pytest
 webtest
+http://hg.logilab.org/review/cubes/skos/archive/tip.tar.bz2#egg=cubicweb-skos



More information about the saem-devel mailing list