Commit 2a5a57db authored by Denis Laxalde's avatar Denis Laxalde
Browse files

Add a "get_cnx" method in skos-import command

We override this command in cubicweb-saem_ref and now need access to a
repository connection. The repository cannot however be instantiated
more than once in a given process (it is instantiated from admincnx()
call). So make a cached method to retrieve a connection.
parent 0a30094c26c5
......@@ -20,6 +20,7 @@ from __future__ import print_function
import logging
import sys
from logilab.common.decorators import cached
from cubicweb.toolsutils import Command, underline_title
from cubicweb.cwctl import CWCTL
from cubicweb.utils import admincnx
......@@ -104,9 +105,13 @@ class ImportSkosData(Command):
'rql': _rql_store_factory,
def get_cnx(self, appid):
return admincnx(appid)
def run(self, args):
appid = args[0]
connection = admincnx(appid)
connection = self.get_cnx(appid)
if self.get('format') == 'lcsv':
scheme_uri = self.get('scheme')
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