From 953dbad0a08ad07755a189fd3ed81a81a7400cf7 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 13 Feb 2013 09:12:05 -0500 Subject: [PATCH] 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 --- rss2email/command.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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" -- 2.26.2