mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Handled empty lines appropriately in supyfact files.
This commit is contained in:
parent
c17f85e51b
commit
e20f69288c
@ -136,9 +136,9 @@ class Lookup(callbacks.Privmsg):
|
||||
cursor.execute("""CREATE TABLE %s (key TEXT, value TEXT)""" % name)
|
||||
sql = """INSERT INTO %s VALUES (%%s, %%s)""" % name
|
||||
for line in fd:
|
||||
if line.startswith('#'):
|
||||
continue
|
||||
line = line.rstrip('\r\n')
|
||||
if not line or line.startswith('#'):
|
||||
continue
|
||||
try:
|
||||
(key, value) = line.split(':', 1)
|
||||
except ValueError:
|
||||
|
@ -73,6 +73,12 @@ class LookupTestCase(PluginTestCase, PluginDocumentation):
|
||||
def testNotEscapingIOError(self):
|
||||
self.assertNotRegexp('lookup add foo asdlfkjsdalfkj', 'IOError')
|
||||
|
||||
def testEmptyLines(self):
|
||||
fd = file(os.path.join(conf.dataDir, 'foo.supyfact'), 'a')
|
||||
fd.write('\n')
|
||||
fd.close()
|
||||
self.assertNotError('lookup add test foo.supyfact')
|
||||
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user