Fixed escaping IOError from add command.

This commit is contained in:
Jeremy Fincher 2003-11-19 22:36:58 +00:00
parent 909597b7ac
commit c17f85e51b
2 changed files with 10 additions and 2 deletions

View File

@ -130,8 +130,8 @@ class Lookup(callbacks.Privmsg):
try:
filename = os.path.join(conf.dataDir, filename)
fd = file(filename)
except OSError, e:
irc.error('Could open %s: %s' % (filename, e))
except EnvironmentError, e:
irc.error('Could not open %s: %s' % (filename, e))
return
cursor.execute("""CREATE TABLE %s (key TEXT, value TEXT)""" % name)
sql = """INSERT INTO %s VALUES (%%s, %%s)""" % name

View File

@ -33,6 +33,11 @@ from test import *
import os
try:
import sqlite
except ImportError:
sqlite = None
import conf
class LookupTestCase(PluginTestCase, PluginDocumentation):
@ -65,6 +70,9 @@ class LookupTestCase(PluginTestCase, PluginDocumentation):
finally:
conf.replyWhenNotCommand = original
def testNotEscapingIOError(self):
self.assertNotRegexp('lookup add foo asdlfkjsdalfkj', 'IOError')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: