mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Fix for bug #848475.
This commit is contained in:
parent
86b41dd4a6
commit
210809ab99
@ -1,3 +1,6 @@
|
||||
* Fixed bug #848475 -- bad error message from regexp-expecting
|
||||
commands.
|
||||
|
||||
* Stopped listing the plugin dispatcher command in the list of
|
||||
commands for that plugin.
|
||||
|
||||
|
10
src/utils.py
10
src/utils.py
@ -209,7 +209,10 @@ def perlReToPythonRe(s):
|
||||
"""Converts a string representation of a Perl regular expression (i.e.,
|
||||
m/^foo$/i or /foo|bar/) to a Python regular expression.
|
||||
"""
|
||||
(kind, regexp, flags) = nonEscapedSlashes.split(s)
|
||||
try:
|
||||
(kind, regexp, flags) = nonEscapedSlashes.split(s)
|
||||
except ValueError: # Unpack list of wrong size.
|
||||
raise ValueError, 'Must be of the form m/.../ or /.../'
|
||||
regexp = regexp.replace('\\/', '/')
|
||||
if kind not in ('', 'm'):
|
||||
raise ValueError, 'Invalid kind: must be in ("", "m")'
|
||||
@ -229,7 +232,10 @@ def perlReToReplacer(s):
|
||||
s/foo/bar/g or s/foo/bar/i) to a Python function doing the equivalent
|
||||
replacement.
|
||||
"""
|
||||
(kind, regexp, replace, flags) = nonEscapedSlashes.split(s)
|
||||
try:
|
||||
(kind, regexp, replace, flags) = nonEscapedSlashes.split(s)
|
||||
except ValueError: # Unpack list of wrong size.
|
||||
raise ValueError, 'Must be of the form s/.../.../'
|
||||
replace = replace.replace('\\/', '/')
|
||||
if kind != 's':
|
||||
raise ValueError, 'Invalid kind: must be "s"'
|
||||
|
@ -73,4 +73,7 @@ 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 testReNoEscapingUnpackListOfWrongSize(self):
|
||||
self.assertNotRegexp('re foo bar baz', 'unpack list of wrong size')
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user