mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Factoids: fix bug when making an alias to a newkey that already has a factoid associated with it.
This commit is contained in:
parent
af32d6bfd3
commit
a345262846
@ -345,11 +345,11 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
# check if we already have the requested relation
|
# check if we already have the requested relation
|
||||||
cursor.execute("""SELECT id FROM relations WHERE
|
cursor.execute("""SELECT id FROM relations WHERE
|
||||||
key_id=? and fact_id=?""",
|
key_id=? and fact_id=?""",
|
||||||
(arelation[1], arelation[2]))
|
(newkey_info[0][0], arelation[2]))
|
||||||
existentrelation = cursor.fetchall()
|
existentrelation = cursor.fetchall()
|
||||||
if len(existentrelation) != 0:
|
if len(existentrelation) != 0:
|
||||||
newkey_info = False
|
newkey_info = False
|
||||||
if len(newkey_info) == 0:
|
elif len(newkey_info) == 0:
|
||||||
cursor.execute("""INSERT INTO keys VALUES (NULL, ?)""",
|
cursor.execute("""INSERT INTO keys VALUES (NULL, ?)""",
|
||||||
(newkey,))
|
(newkey,))
|
||||||
db.commit()
|
db.commit()
|
||||||
|
@ -191,6 +191,10 @@ class FactoidsTestCase(ChannelPluginTestCase):
|
|||||||
self.assertError('alias foo gnoop')
|
self.assertError('alias foo gnoop')
|
||||||
self.assertNotError('alias foo gnoop 2')
|
self.assertNotError('alias foo gnoop 2')
|
||||||
self.assertRegexp('whatis gnoop', 'snorp')
|
self.assertRegexp('whatis gnoop', 'snorp')
|
||||||
|
self.assertNotError('learn floop as meep')
|
||||||
|
self.assertNotError('learn bar as baz')
|
||||||
|
self.assertNotError('alias floop bar')
|
||||||
|
self.assertRegexp('whatis bar', 'meep.*baz')
|
||||||
|
|
||||||
def testRank(self):
|
def testRank(self):
|
||||||
self.assertNotError('learn foo as bar')
|
self.assertNotError('learn foo as bar')
|
||||||
|
Loading…
Reference in New Issue
Block a user