Don't blow up if feedfinder can't be imported.
authorAdam Sampson <ats@offog.org>
Fri, 30 Jan 2009 09:32:05 +0000 (09:32 +0000)
committerAdam Sampson <ats@offog.org>
Fri, 30 Jan 2009 09:32:05 +0000 (09:32 +0000)
NEWS
rawdoglib/rawdog.py

diff --git a/NEWS b/NEWS
index ce59a8a8a8dd21e5b33765d6e0cb15b20cd7f686..bc6cce3924443c977f6ceabbc6b7161f06533ec0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@
 
 Make rawdog work with Python 2.6 (reported by Roy Lanek).
 
+If feedfinder (which now needs Python 2.4 or later) can't be imported,
+just disable it.
+
 Several changes as a result of profiling that significantly speed up
 writing output files:
 
index ba4b5b1668626c803036d024a385359249379920..522644137192d413328c207254c639262efbec31 100644 (file)
@@ -18,7 +18,7 @@
 
 VERSION = "2.12rc3"
 STATE_VERSION = 2
-import feedparser, feedfinder, plugins
+import feedparser, plugins
 from persister import Persistable, Persister
 import os, time, getopt, sys, re, cgi, socket, urllib2, calendar
 import string, locale
@@ -37,6 +37,11 @@ except:
        hashlib = None
        import sha
 
+try:
+       import feedfinder
+except:
+       feedfinder = None
+
 def new_sha1(s = ""):
        """Return a new SHA1 hash object."""
        if hashlib is None:
@@ -850,7 +855,10 @@ class AddFeedEditor:
 
 def add_feed(filename, url, rawdog, config):
        """Try to add a feed to the config file."""
-       feeds = feedfinder.feeds(url)
+       if feedfinder is None:
+               feeds = [url]
+       else:
+               feeds = feedfinder.feeds(url)
        if feeds == []:
                print >>sys.stderr, "Cannot find any feeds in " + url
        else: