diff --git a/plugins/MoobotFactoids/plugin.py b/plugins/MoobotFactoids/plugin.py index 056e3af5d..dddc781e4 100644 --- a/plugins/MoobotFactoids/plugin.py +++ b/plugins/MoobotFactoids/plugin.py @@ -107,11 +107,11 @@ class SqliteMoobotDB(object): filename = plugins.makeChannelFilename(self.filename, channel) if os.path.exists(filename): - db = sqlite3.connect(filename) + db = sqlite3.connect(filename, check_same_thread = False) db.text_factory = str self.dbs[channel] = db return db - db = sqlite3.connect(filename) + db = sqlite3.connect(filename, check_same_thread = False) db.text_factory = str self.dbs[channel] = db cursor = db.cursor() @@ -281,7 +281,7 @@ class SqliteMoobotDB(object): results = cursor.fetchall() return results -MoobotDB = plugins.DB('MoobotFactoids', {'sqlite': SqliteMoobotDB}) +MoobotDB = plugins.DB('MoobotFactoids', {'sqlite3': SqliteMoobotDB}) class MoobotFactoids(callbacks.Plugin): """Add the help for "@help MoobotFactoids" here (assuming you don't implement a MoobotFactoids diff --git a/plugins/MoobotFactoids/test.py b/plugins/MoobotFactoids/test.py index aec775492..94e3c6c7e 100644 --- a/plugins/MoobotFactoids/test.py +++ b/plugins/MoobotFactoids/test.py @@ -31,11 +31,10 @@ from supybot.test import * #import supybot.plugin as plugin import supybot.ircutils as ircutils - try: - import sqlite + import sqlite3 except ImportError: - sqlite = None + from pysqlite2 import dbapi2 as sqlite3 # for python2.4 MF = plugin.loadPluginModule('MoobotFactoids') MFconf = conf.supybot.plugins.MoobotFactoids @@ -223,7 +222,7 @@ class FactoidsTestCase(ChannelPluginTestCase): self.assertRegexp('most authored', 'Most prolific authors:.*moo.*(1).*boo.*(1)') self.assertRegexp('most recent', - "2 latest factoids:.*mogle.*moogle.*") + "2 latest factoids:.*moogle.*mogle.*") self.assertResponse('moogle', 'moo') self.assertRegexp('most popular', "Top 1 requested factoid:.*moogle.*(2)")