X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=blobdiff_plain;f=ipsilon%2Futil%2Fdata.py;h=26fa8599a8655c52ff2a35744b1aff3ff775b9ac;hp=0d1c2dfbc9d9458799bcbd8d7b83c5b838ca0b74;hb=abcefb0f2eece549371f951b58144188d2ac9307;hpb=aa5dc3b417db962a075a092d0d3528010c1059f7 diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index 0d1c2df..26fa859 100644 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -37,11 +37,13 @@ class SqlStore(Log): @classmethod def get_connection(cls, name): if name not in cls.__instances.keys(): - logging.debug('SqlStore new: %s', name) + if cherrypy.config.get('db.conn.log', False): + logging.debug('SqlStore new: %s', name) cls.__instances[name] = SqlStore(name) return cls.__instances[name] def __init__(self, name): + self.db_conn_log = cherrypy.config.get('db.conn.log', False) self.debug('SqlStore init: %s' % name) self.name = name engine_name = name @@ -58,10 +60,13 @@ class SqlStore(Log): # It's not possible to share connections for SQLite between # threads, so let's use the SingletonThreadPool for them pool_args = {'poolclass': SingletonThreadPool} - # pylint: disable=star-args self._dbengine = create_engine(engine_name, **pool_args) self.is_readonly = False + def debug(self, fact): + if self.db_conn_log: + super(SqlStore, self).debug(fact) + def engine(self): return self._dbengine