From 06c85f5c9367e60b78aefe79d232d43a1b8dfe65 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 12 Dec 2003 13:25:03 +0000 Subject: [PATCH] Removed --exact. --- plugins/Factoids.py | 15 +++++---------- test/test_Factoids.py | 2 -- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/plugins/Factoids.py b/plugins/Factoids.py index 35362bb7a..c229d9c7d 100644 --- a/plugins/Factoids.py +++ b/plugins/Factoids.py @@ -361,15 +361,13 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg): _sqlTrans = string.maketrans('*?', '%_') def search(self, irc, msg, args): - """[] [--{regexp,exact}=] [] + """[] [--{regexp}=] [] Searches the keyspace for keys matching . If --regexp is given, - it associated value is taken as a regexp and matched against the keys; - if --exact is given, its associated value is taken as an exact string - to match against the key. + it associated value is taken as a regexp and matched against the keys. """ channel = privmsgs.getChannel(msg, args) - (optlist, rest) = getopt.getopt(args, '', ['regexp=', 'exact=']) + (optlist, rest) = getopt.getopt(args, '', ['regexp=']) if not optlist and not rest: raise callbacks.ArgumentError criteria = [] @@ -377,11 +375,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg): predicateName = 'p' db = self.getDb(channel) for (option, arg) in optlist: - if option == '--exact': - ### FIXME: no way to escape LIKE metacharacters in SQLite. - criteria.append('key LIKE %s') - formats.append('%' + arg + '%') - elif option == '--regexp': + if option == '--regexp': criteria.append('%s(key)' % predicateName) try: r = utils.perlReToPythonRe(arg) @@ -415,4 +409,5 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg): Class = Factoids + # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: diff --git a/test/test_Factoids.py b/test/test_Factoids.py index 29381deab..1f1d6cfe0 100644 --- a/test/test_Factoids.py +++ b/test/test_Factoids.py @@ -98,8 +98,6 @@ if sqlite is not None: self.assertRegexp('search --regexp /^j/', 'jemfinch.*jamessan') self.assertRegexp('search j*', 'jemfinch.*jamessan') - self.assertRegexp('search --exact ke', - 'inkedmn.*strike|strike.*inkedmn') self.assertRegexp('search *ke*', 'inkedmn.*strike|strike.*inkedmn') self.assertRegexp('search ke',