From: Adam Sampson Date: Fri, 30 Jan 2009 09:32:05 +0000 (+0000) Subject: Don't blow up if feedfinder can't be imported. X-Git-Tag: v2.12rc3~1 X-Git-Url: http://git.ozo.com/?a=commitdiff_plain;h=02e902289ced481af842725dcd4264fa3f406927;p=rawdog%2F.git Don't blow up if feedfinder can't be imported. --- diff --git a/NEWS b/NEWS index ce59a8a..bc6cce3 100644 --- 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: diff --git a/rawdoglib/rawdog.py b/rawdoglib/rawdog.py index ba4b5b1..5226441 100644 --- a/rawdoglib/rawdog.py +++ b/rawdoglib/rawdog.py @@ -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: