aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-03-28 09:56:11 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-03-28 09:56:11 +0100
commit6776bd3e56cd5b3b8d26102bf6e5f2337bba7529 (patch)
tree7dc14d640c2414b88f2dab7a0c3fd8f3e4fdf276 /source
parentMinor fix to the /feed view when a feed has no articles. (diff)
downloadnewspipe-6776bd3e56cd5b3b8d26102bf6e5f2337bba7529.tar.gz
newspipe-6776bd3e56cd5b3b8d26102bf6e5f2337bba7529.tar.bz2
newspipe-6776bd3e56cd5b3b8d26102bf6e5f2337bba7529.zip
Minor fix to the /inactives view when a feed has no articles.
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index 5a55cacf..8b222f68 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -443,10 +443,11 @@ class pyAggr3g470r(object):
inactives = []
for feed in feeds:
more_recent_article = self.mongo.get_articles(feed["feed_id"], limit=1)
- last_post = next(more_recent_article)["article_date"]
- elapsed = today - last_post
- if elapsed > datetime.timedelta(days=int(nb_days)):
- inactives.append((feed, elapsed))
+ if more_recent_article.count() != 0:
+ last_post = next(more_recent_article)["article_date"]
+ elapsed = today - last_post
+ if elapsed > datetime.timedelta(days=int(nb_days)):
+ inactives.append((feed, elapsed))
tmpl = lookup.get_template("inactives.html")
return tmpl.render(inactives=inactives, nb_days=int(nb_days))
bgstack15