Return early from NewsManager.updateItems() if the news path listdir call
authorZac Medico <zmedico@gentoo.org>
Thu, 13 Nov 2008 02:00:38 +0000 (02:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 13 Nov 2008 02:00:38 +0000 (02:00 -0000)
fails.

svn path=/main/trunk/; revision=11869

pym/portage/news.py

index 332e05dc1cd4239936b0bdea2cf2c8f737c43373..39589b55dd7781af42a04de902aaa96ef9fcfbe5 100644 (file)
@@ -73,12 +73,10 @@ class NewsManager(object):
                        raise ValueError("Invalid repoID: %s" % repoid)
 
                path = os.path.join(self.portdb.getRepositoryPath(repoid), self.news_path)
-
-               # Skip reading news for repoid if the news dir does not exist.  Requested by
-               # NightMorph :)
-               if not os.path.exists(path):
-                       return None
-               news = os.listdir(path)
+               try:
+                       news = os.listdir(path)
+               except OSError:
+                       return
 
                skipfile = os.path.join(self.unread_path, "news-%s.skip" % repoid)
                skiplist = set(grabfile(skipfile))