mirror of
https://github.com/progval/Limnoria.git
synced 2025-05-05 09:50:52 -05: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
bd1fb9f9a6
commit
67ab067e6a
@ -40,13 +40,6 @@ import supybot.plugins as plugins
|
|||||||
import supybot.ircutils as ircutils
|
import supybot.ircutils as ircutils
|
||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
|
|
||||||
#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:
|
||||||
@ -55,10 +48,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)
|
||||||
@ -121,20 +110,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…
x
Reference in New Issue
Block a user