[kupfer/cee10] plugin.google: Fix mishandling of unreadable searchplugins directories
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer/cee10] plugin.google: Fix mishandling of unreadable searchplugins directories
- Date: Thu, 22 Oct 2009 18:29:46 +0000 (UTC)
commit faf2d2bcb748284ddcfc44c224c7e1706df658eb
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Thu Oct 22 20:26:34 2009 +0200
plugin.google: Fix mishandling of unreadable searchplugins directories
Launchpad https://bugs.launchpad.net/ubuntu/+source/kupfer/+bug/458374
Squashed commit of the following:
commit a6c3911d9744850e20cb8b0d0fb7bd7b9fae1abe
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Sep 30 23:40:05 2009 +0200
plugin.google: Catch IO and OS Errors when reading search descriptions
commit 0fd3a4b33a439311743b187a5b4d8822cd7a8a8c
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Thu Sep 10 23:05:17 2009 +0200
plugin.google: Use os.listdir
kupfer/plugin/google.py | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/kupfer/plugin/google.py b/kupfer/plugin/google.py
index 83a11f4..30ccd08 100644
--- a/kupfer/plugin/google.py
+++ b/kupfer/plugin/google.py
@@ -191,11 +191,6 @@ class OpenSearchSource (Source):
self.output_debug("Found following searchplugins directories",
sep="\n", *plugin_dirs)
- def listfiles(directory):
- """Return a list of files in @directory, without recursing"""
- for dirname, dirs, files in os.walk(directory):
- return files
-
@coroutine
def collect(seq):
"""Collect items in list @seq"""
@@ -208,11 +203,14 @@ class OpenSearchSource (Source):
# files are unique by filename to allow override
visited_files = set()
for pdir in plugin_dirs:
- for f in listfiles(pdir):
- if f in visited_files:
- continue
- parser.send(os.path.join(pdir, f))
- visited_files.add(f)
+ try:
+ for f in os.listdir(pdir):
+ if f in visited_files:
+ continue
+ parser.send(os.path.join(pdir, f))
+ visited_files.add(f)
+ except EnvironmentError, exc:
+ self.output_error(exc)
for s in searches:
yield SearchEngine(s, s["ShortName"])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]