commit: 0cb7426796b2fb082f9176b7b08d08b21b5c86bb
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 15 01:30:39 2016 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 15 01:43:42 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0cb74267
news: skip parsing if News-Item-Format is unspecified
pym/portage/news.py | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/pym/portage/news.py b/pym/portage/news.py
index 28faf83..6020074 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -280,26 +280,26 @@ class NewsItem(object):
if news_format is None:
invalids.append((0, 'News-Item-Format unspecified'))
-
- # Parse the rest
- for i, line in enumerate(lines):
- # Optimization to ignore regex matches on lines that
- # will never match
- if not line.startswith('D'):
- continue
- restricts = { _installedRE :
DisplayInstalledRestriction,
- _profileRE : DisplayProfileRestriction,
- _keywordRE : DisplayKeywordRestriction }
- for regex, restriction in restricts.items():
- match = regex.match(line)
- if match:
- restrict =
restriction(match.groups()[0].strip(), news_format)
- if not restrict.isValid():
- invalids.append((i + 1,
line.rstrip("\n")))
- else:
- self.restrictions.setdefault(
- id(restriction),
[]).append(restrict)
+ else:
+ # Parse the rest
+ for i, line in enumerate(lines):
+ # Optimization to ignore regex matches on lines
that
+ # will never match
+ if not line.startswith('D'):
continue
+ restricts = { _installedRE :
DisplayInstalledRestriction,
+ _profileRE :
DisplayProfileRestriction,
+ _keywordRE :
DisplayKeywordRestriction }
+ for regex, restriction in restricts.items():
+ match = regex.match(line)
+ if match:
+ restrict =
restriction(match.groups()[0].strip(), news_format)
+ if not restrict.isValid():
+ invalids.append((i + 1,
line.rstrip("\n")))
+ else:
+
self.restrictions.setdefault(
+
id(restriction), []).append(restrict)
+ continue
if invalids:
self._valid = False