summaryrefslogtreecommitdiffstats
path: root/pym/portage_news.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage_news.py')
-rw-r--r--pym/portage_news.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/pym/portage_news.py b/pym/portage_news.py
index ea804f31b..736ce3fdc 100644
--- a/pym/portage_news.py
+++ b/pym/portage_news.py
@@ -163,21 +163,14 @@ class NewsItem(object):
#will never match
if not line.startswith("D"):
continue
- match = _installedRE.match( line )
- if match:
- self.restrictions.append(
- DisplayInstalledRestriction( match.groups()[0].strip().rstrip() ) )
- continue
- match = _profileRE.match( line )
- if match:
- self.restrictions.append(
- DisplayProfileRestriction( match.groups()[0].strip().rstrip() ) )
- continue
- match = _keywordRE.match( line )
- if match:
- self.restrictions.append(
- DisplayKeywordRestriction( match.groups()[0].strip().rstrip() ) )
- continue
+ restricts = { _installedRE : DisplayInstalledRestriction,
+ _profileRE : DisplayProfileRestriction,
+ _keywordRE : DisplayKeywordRestriction }
+ for regex, restriction in restricts.iteritems():
+ match = regex.match(line)
+ if match:
+ self.restrictions.append( restriction( match.groups()[0].strip() ) )
+ continue
self._parsed = True
def __getattr__( self, attr ):