1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2026-07-25 23:43:28 +02:00

Removed lines cut after 72 chars

This commit is contained in:
Yann 2015-06-03 10:03:41 +02:00
commit 1a6a367481

View file

@ -35,8 +35,7 @@ class SqlWrapper(object):
@param alchemy_logs bool: If true activate sqlalchemy logger @param alchemy_logs bool: If true activate sqlalchemy logger
""" """
if (alchemy_logs != None and \ if (alchemy_logs != None and bool(alchemy_logs) != self.__class__.sqla_logging):
bool(alchemy_logs) != self.__class__.sqla_logging):
#logging config changed for sqlalchemy #logging config changed for sqlalchemy
self.__class__.restart() self.__class__.restart()
@ -94,8 +93,7 @@ class SqlWrapper(object):
""" """
c.checkConf() c.checkConf()
if c.started(): if c.started():
logger.warning('Starting SqlWrapper but it is allready \ logger.warning('Starting SqlWrapper but it is allready started')
started')
return False return False
c.rengine = c._getEngine(read=True, sqlalogging=None) c.rengine = c._getEngine(read=True, sqlalogging=None)
@ -127,8 +125,7 @@ started')
dbconf = connconf if connconf in c.config['db'] else 'default' dbconf = connconf if connconf in c.config['db'] else 'default'
if dbconf not in c.config['db']: #This check should not be here if dbconf not in c.config['db']: #This check should not be here
raise NameError('Configuration error no db "'+dbconf+'" in \ raise NameError('Configuration error no db "'+dbconf+'" in configuration files')
configuration files')
cfg = c.config['db'][dbconf] #Database config cfg = c.config['db'][dbconf] #Database config
@ -146,8 +143,7 @@ configuration files')
user += (':'+cfg['PASSWORD'] if 'PASSWORD' in cfg else '') user += (':'+cfg['PASSWORD'] if 'PASSWORD' in cfg else '')
if 'HOST' not in cfg: if 'HOST' not in cfg:
logger.info('Not HOST in configuration, using \ logger.info('Not HOST in configuration, using localhost')
localhost')
host = 'localhost' host = 'localhost'
else: else:
host = cfg['HOST'] host = cfg['HOST']
@ -157,8 +153,7 @@ localhost')
conn_str = '%s+%s://'%(cfg['ENGINE'], edata['driver']) conn_str = '%s+%s://'%(cfg['ENGINE'], edata['driver'])
conn_str += '%s@%s/%s'%(user,host,cfg['NAME']) conn_str += '%s@%s/%s'%(user,host,cfg['NAME'])
return sqla.create_engine( conn_str, encoding=edata['encoding'], return sqla.create_engine(conn_str, encoding=edata['encoding'], echo=c._sqllog(sqlalogging))
echo=c._sqllog(sqlalogging))
@classmethod @classmethod
def checkConf(c): def checkConf(c):
@ -182,19 +177,16 @@ localhost')
else: else:
if 'default' not in c.config['db']: if 'default' not in c.config['db']:
if 'dbread' not in c.config: if 'dbread' not in c.config:
err.append('Missing "dbread" in configuration and\ err.append('Missing "dbread" in configuration and no "default" db declared')
no "default" db declared')
if 'dbwrite' not in c.config: if 'dbwrite' not in c.config:
err.append('Missing "dbwrite" in configuration and\ err.append('Missing "dbwrite" in configuration and no "default" db declared')
no "default" db declared')
for dbname in c.config['db']: for dbname in c.config['db']:
db = c.config['db'][dbname] db = c.config['db'][dbname]
if 'ENGINE' not in db: if 'ENGINE' not in db:
err.append('Missing "ENGINE" in database "'+db+'"') err.append('Missing "ENGINE" in database "'+db+'"')
else: else:
if db['ENGINE'] != 'sqlite' and 'USER' not in db: if db['ENGINE'] != 'sqlite' and 'USER' not in db:
err.append('Missing "USER" in database "\ err.append('Missing "USER" in database "'+db+'"')
'+db+'"')
if 'NAME' not in db: if 'NAME' not in db:
err.append('Missing "NAME" in database "'+db+'"') err.append('Missing "NAME" in database "'+db+'"')
@ -203,18 +195,15 @@ localhost')
for ename in c.config['engines']: for ename in c.config['engines']:
engine = c.config['engines'][ename] engine = c.config['engines'][ename]
if 'driver' not in engine: if 'driver' not in engine:
err.append('Missing "driver" in database engine "\ err.append('Missing "driver" in database engine "'+ename+'"')
'+ename+'"')
if 'encoding' not in engine: if 'encoding' not in engine:
err.append('Missing "encoding" in database engine "\ err.append('Missing "encoding" in database engine "'+ename+'"')
'+ename+'"')
if len(err)>0: if len(err)>0:
err_str = "\n" err_str = "\n"
for e in err: for e in err:
err_str += "\t\t"+e+"\n" err_str += "\t\t"+e+"\n"
raise NameError('Configuration errors in LODEL2SQLWRAPPER\ raise NameError('Configuration errors in LODEL2SQLWRAPPER:'+err_str)
:'+err_str)
@property @property