Skip to content
Browse files

Real fix for lack of feedparser on system.

Signed-off-by: Jack Miller <jack@codezen.org>
  • Loading branch information...
1 parent d1ee8b2 commit 0dada2a63379560138b6a571a8d68287b61a512b @themoken committed May 24, 2010
Showing with 10 additions and 8 deletions.
  1. +10 −6 canto/canto_fetch.py
  2. +0 −2 canto/main.py
View
16 canto/canto_fetch.py
@@ -17,6 +17,10 @@
# main is only used when canto-fetch is called from the command line.
# run is used internally by canto when it needs to invoke an update.
+import feedparser_builtin
+
+feedparser = feedparser_builtin
+
from const import VERSION_TUPLE, GIT_SHA
from cfg.base import get_cfg
import utility
@@ -86,17 +90,17 @@ def log_func(x):
cfg.log("interval = %d seconds" % updateInterval)
if opt in ["-s","--sysfp"]:
log_func("Using system feedparser")
- import feedparser
+ global feedparser
+ try:
+ import feedparser as feedparser_system
+ feedparser = feedparser_system
+ except:
+ log_func("Import failed. Falling back on builtin.")
if opt in ["-V","--verbose"]:
verbose = True
elif opt in ["-f","--force"]:
force = True
- if "feedparser" not in locals():
- log_func("Using built-in feedparser")
- import feedparser_builtin as feedparser
- globals()["feedparser"] = feedparser
-
# Remove any crap out of the directory. This is mostly for
# cleaning up when the user has removed a feed from the configuration.
View
2 canto/main.py
@@ -27,8 +27,6 @@
# if input, pass to Gui and interpret return
# if return implies update, queue up work for thread
-import feedparser_builtin as feedparser
-
from process import ProcessHandler
from utility import Cycle
from cfg.base import get_cfg

0 comments on commit 0dada2a

Please sign in to comment.
Something went wrong with that request. Please try again.