Commit c73c7237 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

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.
parent 092344f78877
...@@ -29,17 +29,17 @@ from cubes.skos import rdfio ...@@ -29,17 +29,17 @@ from cubes.skos import rdfio
from cubes.skos.sobjects import graph_extentities, import_skos_extentities, lcsv_extentities 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 from cubicweb.dataimport.massive_store import MassiveObjectStore
return MassiveObjectStore(cnx, **kwargs) return MassiveObjectStore(cnx, **kwargs)
def _nohook_store_factory(cnx, **kwargs): def _nohook_store_factory(cnx, config, **kwargs):
from cubicweb.dataimport.stores import NoHookRQLObjectStore from cubicweb.dataimport.stores import NoHookRQLObjectStore
return NoHookRQLObjectStore(cnx, **kwargs) return NoHookRQLObjectStore(cnx, **kwargs)
def _rql_store_factory(cnx, **kwargs): def _rql_store_factory(cnx, config, **kwargs):
from cubicweb.dataimport.stores import RQLObjectStore from cubicweb.dataimport.stores import RQLObjectStore
return RQLObjectStore(cnx, **kwargs) return RQLObjectStore(cnx, **kwargs)
...@@ -136,7 +136,7 @@ class ImportSkosData(Command): ...@@ -136,7 +136,7 @@ class ImportSkosData(Command):
import_log = LoggingImportLog() import_log = LoggingImportLog()
print(u'\n%s' % underline_title('Importing Skos dataset')) print(u'\n%s' % underline_title('Importing Skos dataset'))
with connection as cnx: 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)
try: try:
(created, updated), conceptschemes = import_skos_extentities( (created, updated), conceptschemes = import_skos_extentities(
cnx, extentities, import_log, store=store) cnx, extentities, import_log, store=store)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment