From 4347c41f72d8c45ad7ebe3be31b83c5ad8523698 Mon Sep 17 00:00:00 2001 From: Lindsey Smith Date: Fri, 4 Mar 2011 08:56:07 -0800 Subject: [PATCH] Potential strengthing of feed file writing on UNIX Handle via links with no title attribute --- rss2email.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rss2email.py b/rss2email.py index d178bad..0dc2d04 100644 --- a/rss2email.py +++ b/rss2email.py @@ -507,7 +507,11 @@ def unlock(feeds, feedfileObject): if not unix: pickle.dump(feeds, open(feedfile, 'w')) else: - pickle.dump(feeds, open(feedfile+'.tmp', 'w')) + fd = open(feedfile+'.tmp', 'w') + pickle.dump(feeds, fd) + fd.flush() + os.fsync(fd.fileno()) + fd.close() os.rename(feedfile+'.tmp', feedfile) fcntl.flock(feedfileObject.fileno(), fcntl.LOCK_UN) @@ -731,7 +735,10 @@ def run(num=None): if ('rel' in extralink) and extralink['rel'] == u'via': extraurl = extralink['href'] extraurl = extraurl.replace('http://www.google.com/reader/public/atom/', 'http://www.google.com/reader/view/') - content += '
Via: '+extralink['title']+'\n' + viatitle = extraurl + if ('title' in extralink): + viatitle = extralink['title'] + content += '
Via: '+viatitle+'\n' content += '

\n' content += "\n\n" else: -- 2.26.2