mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Fix for bug #849619.
This commit is contained in:
parent
23968baf49
commit
d64f5314f8
@ -145,13 +145,17 @@ class Utilities(callbacks.Privmsg):
|
||||
try:
|
||||
f = utils.perlReToReplacer(regexp)
|
||||
substitution = True
|
||||
except ValueError:
|
||||
except ValueError, e:
|
||||
irc.error(msg, 'Invalid regexp: %s' % e.args[0])
|
||||
return
|
||||
if f is None:
|
||||
irc.error(msg, 'Invalid regexp: %s' % e.args[0])
|
||||
return
|
||||
irc.reply(msg, f(text))
|
||||
if f(''): # It matches the empty string.
|
||||
s = 'You probably don\'t want to match the empty string.'
|
||||
irc.error(msg, s)
|
||||
else:
|
||||
irc.reply(msg, f(text))
|
||||
|
||||
|
||||
Class = Utilities
|
||||
|
@ -73,6 +73,9 @@ class UtilitiesTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertNotRegexp('re m/foo/ bar', 'has no attribute')
|
||||
self.assertResponse('re m/a\S+y/ "the bot angryman is hairy"','angry')
|
||||
|
||||
def testReNotEmptyString(self):
|
||||
self.assertError('re s//foo/g blah')
|
||||
|
||||
def testReNoEscapingUnpackListOfWrongSize(self):
|
||||
self.assertNotRegexp('re foo bar baz', 'unpack list of wrong size')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user