[dataimport] Allow to specify files to import to import_seda_schemes
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 02 Mar 2017 18:20:56 +0100
changeset 2399 f9ce0269a69b
parent 2389 08ff736126f1
child 2400 83e093bfa6b9
[dataimport] Allow to specify files to import to import_seda_schemes Will ease later migration to import specific vocabularies.
cubicweb_seda/dataimport.py
--- a/cubicweb_seda/dataimport.py	Wed Mar 01 15:49:31 2017 +0100
+++ b/cubicweb_seda/dataimport.py	Thu Mar 02 18:20:56 2017 +0100
@@ -128,20 +128,20 @@
         return NoHookRQLObjectStore(cnx)
 
 
-def import_seda_schemes(cnx, lcsv_import=lcsv_import):
+def import_seda_schemes(cnx, lcsv_import=lcsv_import, lcsv_files=LCSV_FILES):
     """Import all LCSV data files defined in LCSV_FILES."""
     orig_cwuri2eid = post321_import.cwuri2eid
     try:
-        _import_seda_schemes(cnx, lcsv_import)
+        _import_seda_schemes(cnx, lcsv_import, lcsv_files)
     finally:
         post321_import.cwuri2eid = orig_cwuri2eid
 
 
-def _import_seda_schemes(cnx, lcsv_import=lcsv_import):
+def _import_seda_schemes(cnx, lcsv_import=lcsv_import, lcsv_files=LCSV_FILES):
     """Import all LCSV data files defined in LCSV_FILES."""
     feed_extid2eid_cache(cnx)
     store = get_store(cnx)
-    for title, rtypes, etypes, fname in LCSV_FILES:
+    for title, rtypes, etypes, fname in lcsv_files:
         if not cnx.find('ConceptScheme', title=title):
             print('importing', title.encode('utf-8'))
             scheme = init_seda_scheme(cnx, title)