Compile URL matching regex before using it in the loop.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
parent
6e47055a0b
commit
9ee8166148
1 changed files with 2 additions and 1 deletions
|
@ -219,8 +219,9 @@ class ChangeLog:
|
||||||
category.name.decode('utf8'))
|
category.name.decode('utf8'))
|
||||||
|
|
||||||
body_split = category.body.splitlines()
|
body_split = category.body.splitlines()
|
||||||
|
re_has_url = re.compile('.*http[s]?://.*')
|
||||||
for line_number, line in enumerate(body_split, 1):
|
for line_number, line in enumerate(body_split, 1):
|
||||||
if not re.match('.*http[s]?://.*', line.decode('utf-8')) and \
|
if not re_has_url.match(line.decode('utf-8')) and \
|
||||||
len(line) > MAX_LINE_LENGTH:
|
len(line) > MAX_LINE_LENGTH:
|
||||||
raise InputFormatError(filename,
|
raise InputFormatError(filename,
|
||||||
category.body_line + line_number,
|
category.body_line + line_number,
|
||||||
|
|
Loading…
Reference in a new issue