Fixed caching.

master
pictuga 2013-04-22 22:56:38 +02:00
parent 83d0dcce4d
commit f95c5dcf0d
1 changed files with 5 additions and 2 deletions

View File

@ -85,6 +85,9 @@ class Cache:
self.save() self.save()
def save(self): def save(self):
if len(self._cache) == 0:
return
txt = "" txt = ""
for (key, bdata) in self._cache.iteritems(): for (key, bdata) in self._cache.iteritems():
txt += "\n" + str(key) + "\t" + bdata txt += "\n" + str(key) + "\t" + bdata
@ -279,7 +282,7 @@ def Fill(rss, cache):
if cached is not None: if cached is not None:
log('cached') log('cached')
item.content = cached item.content = cached
cache.save(item.link, cached) cache.set(item.link, cached)
return item return item
# download # download
@ -294,7 +297,7 @@ def Fill(rss, cache):
out = readability.Document(data.decode(enc, 'ignore'), url=url).summary(True) out = readability.Document(data.decode(enc, 'ignore'), url=url).summary(True)
item.content = out item.content = out
cache.save(item.link, out) cache.set(item.link, out)
def Gather(data, cachePath): def Gather(data, cachePath):
# fetch feed # fetch feed