summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-12 18:43:19 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-12 18:43:19 +0000
commit3c12e1cd64bfa8ace390f1a42d8e9b5ed3adca55 (patch)
treefde3da159003262d1a25df96d6294f826e11f28b
parentcae5acc17d9dd328662eb7788510b8d0a2a1e743 (diff)
downloadportage-3c12e1cd64bfa8ace390f1a42d8e9b5ed3adca55.tar.gz
portage-3c12e1cd64bfa8ace390f1a42d8e9b5ed3adca55.tar.bz2
portage-3c12e1cd64bfa8ace390f1a42d8e9b5ed3adca55.zip
Instead of raising a TypeError from the NewsItem constructor, check the path
inside NewsManager.updateItems() before the NewsItem constructor is called. svn path=/main/trunk/; revision=11863
-rw-r--r--pym/portage/news.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/pym/portage/news.py b/pym/portage/news.py
index 9d51d8baf..57db9ff41 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -82,11 +82,11 @@ class NewsManager(object):
for itemid in news:
if itemid in skiplist:
continue
- try:
- filename = os.path.join(path, itemid, itemid + "." + self.language_id + ".txt")
- item = NewsItem(filename, itemid)
- except (TypeError):
+ filename = os.path.join(path, itemid,
+ itemid + "." + self.language_id + ".txt")
+ if not os.path.isfile(filename):
continue
+ item = NewsItem(filename, itemid)
if item.isRelevant(profile=self._profile_path,
config=self.config, vardb=self.vdb):
updates.append(item)
@@ -169,8 +169,6 @@ class NewsItem(object):
"""
For a given news item we only want if it path is a file.
"""
- if not os.path.isfile(path):
- raise TypeError("%s is no regular file" % path)
self.path = path
self.name = name
self._parsed = False