Fixed exception when restarting mysql connection

This commit is contained in:
Matthias Schiffer 2010-07-06 15:18:59 +02:00
parent da16ab1b1b
commit 50ae546613

View file

@ -12,7 +12,11 @@ class Module(ModuleBase):
def _connect(self): def _connect(self):
if self.db: if self.db:
try:
self.db.close() self.db.close()
except:
pass
self.db = MySQLdb.connect(host = self.conf['host'], user = self.conf['user'], passwd = self.conf['passwd'], db = self.conf['db'], use_unicode = True, charset = 'utf8') self.db = MySQLdb.connect(host = self.conf['host'], user = self.conf['user'], passwd = self.conf['passwd'], db = self.conf['db'], use_unicode = True, charset = 'utf8')
def cursor(self): def cursor(self):