mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
take out getDb override from factoids, since i have changed it upstream, in plugins.__init__.py, to use proper sqlite3 syntax.
This commit is contained in:
parent
1b0aa48368
commit
e46948400d
@ -42,13 +42,6 @@ import supybot.callbacks as callbacks
|
||||
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
||||
_ = PluginInternationalization('Factoids')
|
||||
|
||||
#try:
|
||||
#import sqlite3 as sqlite
|
||||
#except ImportError:
|
||||
#raise callbacks.Error, 'You need to have PySQLite installed to use this ' \
|
||||
#'plugin. Download it at ' \
|
||||
#'<http://code.google.com/p/pysqlite/>'
|
||||
|
||||
try:
|
||||
import sqlite3
|
||||
except ImportError:
|
||||
@ -57,10 +50,6 @@ except ImportError:
|
||||
import re
|
||||
from supybot.utils.seq import dameraulevenshtein
|
||||
|
||||
# these are needed cuz we are overriding getdb
|
||||
import threading
|
||||
import supybot.world as world
|
||||
|
||||
def getFactoid(irc, msg, args, state):
|
||||
assert not state.channel
|
||||
callConverter('channel', irc, msg, args, state)
|
||||
@ -123,20 +112,6 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
db.commit()
|
||||
return db
|
||||
|
||||
# override this because sqlite3 doesn't have autocommit
|
||||
# use isolation_level instead.
|
||||
def getDb(self, channel):
|
||||
"""Use this to get a database for a specific channel."""
|
||||
currentThread = threading.currentThread()
|
||||
if channel not in self.dbCache and currentThread == world.mainThread:
|
||||
self.dbCache[channel] = self.makeDb(self.makeFilename(channel))
|
||||
if currentThread != world.mainThread:
|
||||
db = self.makeDb(self.makeFilename(channel))
|
||||
else:
|
||||
db = self.dbCache[channel]
|
||||
db.isolation_level = None
|
||||
return db
|
||||
|
||||
def getCommandHelp(self, command, simpleSyntax=None):
|
||||
method = self.getCommandMethod(command)
|
||||
if method.im_func.func_name == 'learn':
|
||||
|
Loading…
Reference in New Issue
Block a user