db stuff
This commit is contained in:
parent
3fde4692d1
commit
16ddabfe2a
5 changed files with 12 additions and 147 deletions
12
core/main.py
12
core/main.py
|
@ -73,6 +73,10 @@ def run(bot, func, input):
|
|||
except:
|
||||
bot.logger.exception("Error in plugin {}:".format(func._filename))
|
||||
return
|
||||
finally:
|
||||
if uses_db:
|
||||
print "Close"
|
||||
input.db.close()
|
||||
else:
|
||||
kw = dict((key, input[key]) for key in args if key in input)
|
||||
try:
|
||||
|
@ -80,6 +84,10 @@ def run(bot, func, input):
|
|||
except:
|
||||
bot.logger.exception("Error in plugin {}:".format(func._filename))
|
||||
return
|
||||
finally:
|
||||
if uses_db:
|
||||
print "Close"
|
||||
input.db.close()
|
||||
else:
|
||||
try:
|
||||
out = func(input.inp)
|
||||
|
@ -89,10 +97,6 @@ def run(bot, func, input):
|
|||
if out is not None:
|
||||
input.reply(unicode(out))
|
||||
|
||||
if uses_db:
|
||||
# close SQLAlchemy session
|
||||
input.db.close()
|
||||
|
||||
|
||||
def do_sieve(sieve, bot, input, func, type, args):
|
||||
try:
|
||||
|
|
Reference in a new issue