[server/sources/native] refactor to remove useless injection
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Wed, 13 Mar 2019 00:01:35 +0100
changeset 12883 d5bbf030f967
parent 12882 3ddd03309315
child 12884 9754c40c732a
[server/sources/native] refactor to remove useless injection
cubicweb/server/sources/native.py
--- a/cubicweb/server/sources/native.py	Wed Mar 13 00:15:48 2019 +0100
+++ b/cubicweb/server/sources/native.py	Wed Mar 13 00:01:35 2019 +0100
@@ -51,8 +51,7 @@
 from cubicweb.server.rqlannotation import set_qdata
 from cubicweb.server.hook import CleanupDeletedEidsCacheOp
 from cubicweb.server.edition import EditedEntity
-from cubicweb.server.sources import AbstractSource, dbg_st_search, dbg_results
-from cubicweb.server.sources.rql2sql import SQLGenerator
+from cubicweb.server.sources import AbstractSource, dbg_st_search, dbg_results, rql2sql
 from cubicweb.misc.source_highlight import highlight_terminal
 from cubicweb.statsd_logger import statsd_timeit
 
@@ -260,7 +259,7 @@
 class NativeSQLSource(SQLAdapterMixIn, AbstractSource):
     """adapter for source using the native cubicweb schema (see below)
     """
-    sqlgen_class = SQLGenerator
+
     options = (
         ('db-driver',
          {'type': 'string',
@@ -333,8 +332,8 @@
             self.authentifiers.insert(0, EmailPasswordAuthentifier(self))
         AbstractSource.__init__(self, repo, source_config, *args, **kwargs)
         # sql generator
-        self._rql_sqlgen = self.sqlgen_class(self.schema, self.dbhelper,
-                                             ATTR_MAP.copy())
+        self._rql_sqlgen = rql2sql.SQLGenerator(self.schema, self.dbhelper,
+                                                ATTR_MAP.copy())
         # full text index helper
         self.do_fti = not repo.config['delay-full-text-indexation']
         # sql queries cache