Merge pull request #1524 from jberry-suse/comments-command-find-multiline

osclib/comments: command_find: use MULTILINE mode.
This commit is contained in:
Jimmy Berry 2018-05-09 18:23:34 -05:00 committed by GitHub
commit 90155fc0fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,14 +119,15 @@ class CommentAPI(object):
Usage (in comment):
@<user> <command> [args...]
"""
command_re = re.compile(r'^@(?P<user>[^ ]+) (?P<args>.*)$')
command_re = re.compile(r'^@(?P<user>[^ ]+) (?P<args>.*)$', re.MULTILINE)
# Search for commands in the order the comment was created.
for comment in sorted(comments.values(), key=lambda c: c['when']):
if who_allowed and comment['who'] not in who_allowed:
continue
match = command_re.search(comment['comment'])
# Handle stupid line endings returned in comments.
match = command_re.search(comment['comment'].replace('\r', ''))
if not match:
continue