equal
deleted
inserted
replaced
49 from cubicweb.server.utils import crypt_password, verify_and_update |
49 from cubicweb.server.utils import crypt_password, verify_and_update |
50 from cubicweb.server.sqlutils import SQL_PREFIX, SQLAdapterMixIn |
50 from cubicweb.server.sqlutils import SQL_PREFIX, SQLAdapterMixIn |
51 from cubicweb.server.rqlannotation import set_qdata |
51 from cubicweb.server.rqlannotation import set_qdata |
52 from cubicweb.server.hook import CleanupDeletedEidsCacheOp |
52 from cubicweb.server.hook import CleanupDeletedEidsCacheOp |
53 from cubicweb.server.edition import EditedEntity |
53 from cubicweb.server.edition import EditedEntity |
54 from cubicweb.server.sources import AbstractSource, dbg_st_search, dbg_results |
54 from cubicweb.server.sources import AbstractSource, dbg_st_search, dbg_results, rql2sql |
55 from cubicweb.server.sources.rql2sql import SQLGenerator |
|
56 from cubicweb.misc.source_highlight import highlight_terminal |
55 from cubicweb.misc.source_highlight import highlight_terminal |
57 from cubicweb.statsd_logger import statsd_timeit |
56 from cubicweb.statsd_logger import statsd_timeit |
58 |
57 |
59 |
58 |
60 ATTR_MAP = {} |
59 ATTR_MAP = {} |
258 |
257 |
259 |
258 |
260 class NativeSQLSource(SQLAdapterMixIn, AbstractSource): |
259 class NativeSQLSource(SQLAdapterMixIn, AbstractSource): |
261 """adapter for source using the native cubicweb schema (see below) |
260 """adapter for source using the native cubicweb schema (see below) |
262 """ |
261 """ |
263 sqlgen_class = SQLGenerator |
262 |
264 options = ( |
263 options = ( |
265 ('db-driver', |
264 ('db-driver', |
266 {'type': 'string', |
265 {'type': 'string', |
267 'default': 'postgres', |
266 'default': 'postgres', |
268 # XXX use choice type |
267 # XXX use choice type |
331 self.authentifiers = [LoginPasswordAuthentifier(self)] |
330 self.authentifiers = [LoginPasswordAuthentifier(self)] |
332 if repo.config['allow-email-login']: |
331 if repo.config['allow-email-login']: |
333 self.authentifiers.insert(0, EmailPasswordAuthentifier(self)) |
332 self.authentifiers.insert(0, EmailPasswordAuthentifier(self)) |
334 AbstractSource.__init__(self, repo, source_config, *args, **kwargs) |
333 AbstractSource.__init__(self, repo, source_config, *args, **kwargs) |
335 # sql generator |
334 # sql generator |
336 self._rql_sqlgen = self.sqlgen_class(self.schema, self.dbhelper, |
335 self._rql_sqlgen = rql2sql.SQLGenerator(self.schema, self.dbhelper, |
337 ATTR_MAP.copy()) |
336 ATTR_MAP.copy()) |
338 # full text index helper |
337 # full text index helper |
339 self.do_fti = not repo.config['delay-full-text-indexation'] |
338 self.do_fti = not repo.config['delay-full-text-indexation'] |
340 # sql queries cache |
339 # sql queries cache |
341 self._cache = QueryCache(repo.config['rql-cache-size']) |
340 self._cache = QueryCache(repo.config['rql-cache-size']) |
342 # (etype, attr) / storage mapping |
341 # (etype, attr) / storage mapping |