From 3c12e1cd64bfa8ace390f1a42d8e9b5ed3adca55 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 12 Nov 2008 18:43:19 +0000 Subject: 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 --- pym/portage/news.py | 10 ++++------ 1 file 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 -- cgit v1.2.3-1-g7c22