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

Handle errors in 'skos-import' command

We handle errors from import code as well as user interruption. This is
mostly in preparation of the next changeset in which we'll add some
cleanup logic.
parent 2b88d62b95d1
......@@ -101,9 +101,14 @@ class ImportSkosData(Command):
import_log = LoggingImportLog()
with admincnx(appid) as cnx:
store = self.cw_store_factories[self.get('cw-store')](cnx)
try:
(created, updated), conceptschemes = import_skos_extentities(
cnx, graph_extentities(graph), import_log, store=store)
cnx.commit()
except BaseException as exc:
cnx.rollback()
print(u"Aborting due to: '%s'" % exc)
else:
print(u'Created: %d\nUpdated: %d' % (len(created), len(updated)))
if conceptschemes:
print(u'Concept schemes:\n* %s' % '\n* '.join(conceptschemes))
......
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