diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-22 11:18:11 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-22 11:18:11 +0100 |
commit | a30f367425870f10cd95bce39e6ec13f98b73fe5 (patch) | |
tree | db73532cbee407dd7fd41f5a8597b00b0b4f4015 /source/pyAggr3g470r.py | |
parent | Now using template inheritance. (diff) | |
download | newspipe-a30f367425870f10cd95bce39e6ec13f98b73fe5.tar.gz newspipe-a30f367425870f10cd95bce39e6ec13f98b73fe5.tar.bz2 newspipe-a30f367425870f10cd95bce39e6ec13f98b73fe5.zip |
Added template for the page of favorite articles.
Diffstat (limited to 'source/pyAggr3g470r.py')
-rwxr-xr-x | source/pyAggr3g470r.py | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index de436ff4..43023a1a 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -1054,34 +1054,12 @@ class pyAggr3g470r(object): List of favorites articles """ feeds = self.mongo.get_all_feeds() - html = htmlheader() - html += htmlnav - html += """<div class="left inner">""" - html += "<h1>Your favorites articles</h1>" + articles = {} for feed in feeds: - new_feed_section = True - for article in self.mongo.get_articles_from_collection(feed["feed_id"]): - if article["article_like"] == True: - if new_feed_section is True: - new_feed_section = False - html += """<h2><a name="%s"><a href="%s" rel="noreferrer"target="_blank">%s</a></a><a href="%s" rel="noreferrer" target="_blank"><img src="%s" width="28" height="28" /></a></h2>\n""" % \ - (feed["feed_id"], feed["site_link"], feed["feed_title"], feed["feed_link"], feed["feed_image"]) - - # descrition for the CSS ToolTips - article_content = utils.clear_string(article["article_content"]) - if article_content: - description = " ".join(article_content[:500].split(' ')[:-1]) - else: - description = "No description." - - # a description line per article (date, title of the article and - # CSS description tooltips on mouse over) - html += article["article_date"].strftime('%Y-%m-%d %H:%M') + " - " + \ - """<a class="tooltip" href="/article/%s:%s" rel="noreferrer" target="_blank">%s<span class="classic">%s</span></a><br />\n""" % \ - (feed["feed_id"], article["article_id"], article["article_title"][:150], description) - html += "<hr />\n" - html += htmlfooter - return html + articles[feed["feed_id"]] = self.mongo.get_articles_from_collection(feed["feed_id"]) + tmpl = lookup.get_template("favorites.html") + return tmpl.render(feeds=feeds, \ + articles=articles) favorites.exposed = True |