From: W. Trevor King Date: Wed, 13 Feb 2013 14:12:05 +0000 (-0500) Subject: command: In run(), save feeds even after errors X-Git-Tag: v3.0~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=953dbad0a08ad07755a189fd3ed81a81a7400cf7;p=rss2email.git command: In run(), save feeds even after errors It's annoying to have a few feeds processed successfully and then have one feed with a configuration error take down the process without saving. With this commit, we always safe the feeds, regardless of any error. We also catch and log any RSS2EmailError, not just the NoToEmailAddress and ProcessingErrors we caught earlier. Signed-off-by: W. Trevor King --- diff --git a/rss2email/command.py b/rss2email/command.py index d404155..8d8fc82 100644 --- a/rss2email/command.py +++ b/rss2email/command.py @@ -53,16 +53,16 @@ def run(feeds, args): "Fetch feeds and send entry emails." if not args.index: args.index = range(len(feeds)) - for index in args.index: - feed = feeds.index(index) - if feed.active: - try: - feed.run(send=args.send) - except _error.NoToEmailAddress as e: - e.log() - except _error.ProcessingError as e: - e.log() - feeds.save() + try: + for index in args.index: + feed = feeds.index(index) + if feed.active: + try: + feed.run(send=args.send) + except _error.RSS2EmailError as e: + e.log() + finally: + feeds.save() def list(feeds, args): "List all the feeds in the database"