From f95c5dcf0d99acea3e9fd7e7bddf5398de73be0b Mon Sep 17 00:00:00 2001 From: pictuga Date: Mon, 22 Apr 2013 22:56:38 +0200 Subject: [PATCH] Fixed caching. --- morss.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/morss.py b/morss.py index 1587a01..e0110cc 100644 --- a/morss.py +++ b/morss.py @@ -85,6 +85,9 @@ class Cache: self.save() def save(self): + if len(self._cache) == 0: + return + txt = "" for (key, bdata) in self._cache.iteritems(): txt += "\n" + str(key) + "\t" + bdata @@ -279,7 +282,7 @@ def Fill(rss, cache): if cached is not None: log('cached') item.content = cached - cache.save(item.link, cached) + cache.set(item.link, cached) return item # download @@ -294,7 +297,7 @@ def Fill(rss, cache): out = readability.Document(data.decode(enc, 'ignore'), url=url).summary(True) item.content = out - cache.save(item.link, out) + cache.set(item.link, out) def Gather(data, cachePath): # fetch feed