[PATCH 3 of 3 skos] Pass command "config" to dataimport store factory functions

Denis Laxalde denis.laxalde at logilab.fr
Mon Jan 8 12:34:38 CET 2018

# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1515410311 -3600
#      Mon Jan 08 12:18:31 2018 +0100
# Node ID 2d545f396263d3cca3a654b8a4dd7112739ba98b
# Parent  092344f78877c184001fb8cb864762a3d8167936
Pass command "config" to dataimport store factory functions

This will be useful in cubicweb-saem_ref to specify parameters for the
metadata generator through an extra command option.

diff --git a/ccplugin.py b/ccplugin.py
--- a/ccplugin.py
+++ b/ccplugin.py
@@ -29,17 +29,17 @@ from cubes.skos import rdfio
 from cubes.skos.sobjects import graph_extentities, import_skos_extentities, lcsv_extentities
-def _massive_store_factory(cnx, **kwargs):
+def _massive_store_factory(cnx, config, **kwargs):
     from cubicweb.dataimport.massive_store import MassiveObjectStore
     return MassiveObjectStore(cnx, **kwargs)
-def _nohook_store_factory(cnx, **kwargs):
+def _nohook_store_factory(cnx, config, **kwargs):
     from cubicweb.dataimport.stores import NoHookRQLObjectStore
     return NoHookRQLObjectStore(cnx, **kwargs)
-def _rql_store_factory(cnx, **kwargs):
+def _rql_store_factory(cnx, config, **kwargs):
     from cubicweb.dataimport.stores import RQLObjectStore
     return RQLObjectStore(cnx, **kwargs)
@@ -136,7 +136,7 @@ class ImportSkosData(Command):
         import_log = LoggingImportLog()
         print(u'\n%s' % underline_title('Importing Skos dataset'))
         with connection as cnx:
-            store = self.cw_store_factories[self.get('cw-store')](cnx)
+            store = self.cw_store_factories[self.get('cw-store')](cnx, self.config)
                 (created, updated), conceptschemes = import_skos_extentities(
                     cnx, extentities, import_log, store=store)

More information about the saem-devel mailing list