public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: [gentoo-portage-dev] [PATCH 3/3] news: skip parsing if News-Item-Format is unspecified
Date: Wed, 14 Sep 2016 21:30:39 -0400	[thread overview]
Message-ID: <20160915013039.15646-3-floppym@gentoo.org> (raw)
In-Reply-To: <20160915013039.15646-1-floppym@gentoo.org>

---
 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
-- 
2.10.0



  parent reply	other threads:[~2016-09-15  1:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15  1:30 [gentoo-portage-dev] [PATCH 1/3] test_NewsItem: Add News-Item-Format to template Mike Gilbert
2016-09-15  1:30 ` [gentoo-portage-dev] [PATCH 2/3] news: Support News-Item-Format 2.0 Mike Gilbert
2016-09-15  1:30 ` Mike Gilbert [this message]
2016-09-15  2:04   ` [gentoo-portage-dev] [PATCH 3/3] news: skip parsing if News-Item-Format is unspecified Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160915013039.15646-3-floppym@gentoo.org \
    --to=floppym@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox