diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-03-28 09:48:26 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-03-28 09:48:26 +0100 |
commit | b51fef13f40421b4e98b5a8b29894e8f8ac91205 (patch) | |
tree | 654396c3958d73f9bdb40305973b66cb1bc9e009 /source | |
parent | don't print the tree. (diff) | |
download | newspipe-b51fef13f40421b4e98b5a8b29894e8f8ac91205.tar.gz newspipe-b51fef13f40421b4e98b5a8b29894e8f8ac91205.tar.bz2 newspipe-b51fef13f40421b4e98b5a8b29894e8f8ac91205.zip |
Minor fix to the /feed view when a feed has no articles.
Diffstat (limited to 'source')
-rwxr-xr-x | source/pyAggr3g470r.py | 9 | ||||
-rw-r--r-- | source/static/templates/feed.html | 22 |
2 files changed, 19 insertions, 12 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index b68c8969..5a55cacf 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -277,7 +277,7 @@ class pyAggr3g470r(object): except KeyError: return self.error("<p>This feed do not exists.</p>") - if articles != []: + if articles.count() != 0: today = datetime.datetime.now() last_article = articles[0]["article_date"] first_article = articles[self.mongo.nb_articles(feed_id)-2]["article_date"] @@ -288,14 +288,17 @@ class pyAggr3g470r(object): top_words = utils.top_words(articles = self.mongo.get_articles(feed_id), n=50, size=int(word_size)) tag_cloud = utils.tag_cloud(top_words) - tmpl = lookup.get_template("feed.html") - return tmpl.render(feed=feed, articles=articles, favorites=favorites, \ + tmpl = lookup.get_template("feed.html") + return tmpl.render(feed=feed, articles=articles, favorites=favorites, \ nb_articles_feed=nb_articles_feed, nb_articles_total=nb_articles_total, nb_unread_articles_feed=nb_unread_articles_feed, \ nb_favorites = nb_favorites, first_post_date=first_article, end_post_date=last_article, \ average=average, delta=delta, elapsed=elapsed, \ tag_cloud=tag_cloud, word_size=word_size, \ mail_to=conf.mail_to, mail_notification_enabled=conf.MAIL_ENABLED) + tmpl = lookup.get_template("feed.html") + return tmpl.render(feed=feed, articles=[]) + feed.exposed = True @auth.require() diff --git a/source/static/templates/feed.html b/source/static/templates/feed.html index f4a35e77..bcc1ec6c 100644 --- a/source/static/templates/feed.html +++ b/source/static/templates/feed.html @@ -4,15 +4,21 @@ import utils %> <div class="left inner"> - <p>The feed <b>${feed['feed_title']}</b> contains <b>${format(nb_articles_feed, ',d')}</b> articles. - Representing ${round((nb_articles_feed / nb_articles_total) * 100, 4)} percent of the total (${format(nb_articles_total, ',d')} articles). - <br /> - Address of the feed: <a href="${feed['feed_link']}">${feed['feed_link']}</a>. - <br /> - Address of the site: <a href="${feed['site_link']}">${feed['site_link']}</a>.</p> + %if articles != []: + <p>The feed <b>${feed['feed_title']}</b> contains <b>${format(nb_articles_feed, ',d')}</b> articles. + Representing ${round((nb_articles_feed / nb_articles_total) * 100, 4)} percent of the total (${format(nb_articles_total, ',d')} articles). + <br /> + Address of the feed: <a href="${feed['feed_link']}">${feed['feed_link']}</a>. + <br /> + Address of the site: <a href="${feed['site_link']}">${feed['site_link']}</a>.</p> - %if articles: <p>${(nb_unread_articles_feed == 0 and ["All articles are read"] or [str(nb_unread_articles_feed) + " unread article" + (nb_unread_articles_feed == 1 and [""] or ["s"])[0]])[0]}.</p> + %else: + <p>No articles for the feed <b>${feed['feed_title']}</b>. + <br /> + Address of the feed: <a href="${feed['feed_link']}">${feed['feed_link']}</a>. + <br /> + Address of the site: <a href="${feed['site_link']}">${feed['site_link']}</a>.</p> %endif %if feed["mail"] == True: @@ -96,8 +102,6 @@ import utils %endfor ${html} %endif - %else: - <p>No articles yet.</p> %endif |