mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +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
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
||||||
_ = PluginInternationalization('Factoids')
|
_ = 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:
|
try:
|
||||||
import sqlite3
|
import sqlite3
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -57,10 +50,6 @@ except ImportError:
|
|||||||
import re
|
import re
|
||||||
from supybot.utils.seq import dameraulevenshtein
|
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):
|
def getFactoid(irc, msg, args, state):
|
||||||
assert not state.channel
|
assert not state.channel
|
||||||
callConverter('channel', irc, msg, args, state)
|
callConverter('channel', irc, msg, args, state)
|
||||||
@ -123,20 +112,6 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
db.commit()
|
db.commit()
|
||||||
return db
|
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):
|
def getCommandHelp(self, command, simpleSyntax=None):
|
||||||
method = self.getCommandMethod(command)
|
method = self.getCommandMethod(command)
|
||||||
if method.im_func.func_name == 'learn':
|
if method.im_func.func_name == 'learn':
|
||||||
|
Loading…
Reference in New Issue
Block a user