mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-06-19 13:17:21 +02:00
forget about unicode, and just use text_factory str for sqlite to retrieve raw bytes out of text fields without conversions.
This commit is contained in:
parent
6ceeace44d
commit
629ede010a
@ -72,8 +72,11 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def makeDb(self, filename):
|
def makeDb(self, filename):
|
||||||
"""Create the database and connect to it."""
|
"""Create the database and connect to it."""
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
return sqlite3.connect(filename)
|
db = sqlite3.connect(filename)
|
||||||
|
db.text_factory = str
|
||||||
|
return db
|
||||||
db = sqlite3.connect(filename)
|
db = sqlite3.connect(filename)
|
||||||
|
db.text_factory = str
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""CREATE TABLE triggers (
|
cursor.execute("""CREATE TABLE triggers (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
@ -115,7 +118,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
def _runCommandFunction(self, irc, msg, command):
|
def _runCommandFunction(self, irc, msg, command):
|
||||||
"""Run a command from message, as if command was sent over IRC."""
|
"""Run a command from message, as if command was sent over IRC."""
|
||||||
# need to encode it from unicode, since sqlite stores text as unicode.
|
# need to encode it from unicode, since sqlite stores text as unicode.
|
||||||
tokens = callbacks.tokenize(unicode.encode(command, 'utf8'))
|
tokens = callbacks.tokenize(command)
|
||||||
try:
|
try:
|
||||||
self.Proxy(irc.irc, msg, tokens)
|
self.Proxy(irc.irc, msg, tokens)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user