Update to proper super() usage and make sure we're not trying to close() None

This commit is contained in:
James Vega 2004-09-03 19:12:05 +00:00
parent 11c4716c61
commit 5f00a39ce4

View File

@ -259,6 +259,7 @@ class SqliteInfobotDB(object):
raise dbi.InvalidDBError, str(e) raise dbi.InvalidDBError, str(e)
def close(self): def close(self):
if self.db is not None:
self.db.close() self.db.close()
def changeIs(self, factoid, replacer): def changeIs(self, factoid, replacer):
@ -377,7 +378,7 @@ class Dunno(Exception):
class Infobot(callbacks.PrivmsgCommandAndRegexp): class Infobot(callbacks.PrivmsgCommandAndRegexp):
regexps = ['doForget', 'doChange', 'doFactoid', 'doUnknown'] regexps = ['doForget', 'doChange', 'doFactoid', 'doUnknown']
def __init__(self): def __init__(self):
callbacks.PrivmsgCommandAndRegexp.__init__(self) super(Infobot, self).__init__()
try: try:
self.db = InfobotDB() self.db = InfobotDB()
except Exception: except Exception:
@ -536,7 +537,7 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
self.log.debug('Bailing since we received an empty msg.') self.log.debug('Bailing since we received an empty msg.')
return return
msg = ircmsgs.privmsg(msg.args[0], payload, prefix=msg.prefix) msg = ircmsgs.privmsg(msg.args[0], payload, prefix=msg.prefix)
callbacks.PrivmsgCommandAndRegexp.doPrivmsg(self, irc, msg) super(Infobot, self).doPrivmsg(irc, msg)
finally: finally:
self.force = False self.force = False
self.replied = False self.replied = False