Commit 1fa37c0a authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

Minor refactoring of initial schemes import code to ease overriding

by e.g. saem_ref which want to assign ark to created schemes.
parent ece22f65f9e5
......@@ -105,6 +105,11 @@ def lcsv_check(cnx, store, fname, scheme_uri):
def init_seda_scheme(cnx, title):
description = u'edition 2009' if title.startswith('SEDA :') else None
return cnx.create_entity('ConceptScheme', title=title, description=description)
def import_seda_schemes(cnx, lcsv_import=lcsv_import):
"""Import all LCSV data files defined in LCSV_FILES"""
if cnx.repo.system_source.dbdriver == 'postgres':
......@@ -116,9 +121,7 @@ def import_seda_schemes(cnx, lcsv_import=lcsv_import):
for title, rtypes, etypes, fname in LCSV_FILES:
if not cnx.find('ConceptScheme', title=title):
print('importing', title.encode('utf-8'))
description = u'edition 2009' if title.startswith('SEDA :') else None
scheme = cnx.create_entity('ConceptScheme', title=title,
scheme = init_seda_scheme(cnx, title)
lcsv_import(cnx, store, fname, scheme.cwuri)
if not isinstance(rtypes, tuple):
rtypes = (rtypes,)
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