From 902bd9c654b557e5f139e5bdc91fb3f7a34bd87c Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Mon, 21 Feb 2011 10:18:59 +0100 Subject: Added new page (feed). This page is a kind of summary for each feeds. --- pyAggr3g470r.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index a3a015bb..04526dd8 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -516,6 +516,58 @@ class Root: article.exposed = True + def feed(self, feed_id): + """ + """ + try: + feed = self.feeds[feed_id] + except KeyError: + return self.error_page("This feed do not exists.") + html = htmlheader() + html += htmlnav + html += """
""" + html += "

The feed " + feed.feed_title + " contains " + str(feed.nb_articles) + " articles.

" + html += "

Recent articles:

" + for article in feed.articles.values()[:10]: + if article.article_readed == "0": + # not readed articles are in bold + not_read_begin, not_read_end = "", "" + else: + not_read_begin, not_read_end = "", "" + + # display a heart for faved articles + if article.like == "1": + like = """ """ + else: + like = "" + + # Descrition for the CSS ToolTips + article_content = utils.clear_string(article.article_description) + if article_content: + description = " ".join(article_content[:500].split(' ')[:-1]) + else: + description = "No description." + # Title of the article + article_title = article.article_title + if len(article_title) >= 110: + article_title = article_title[:110] + " ..." + + # a description line per article (date, title of the article and + # CSS description tooltips on mouse over) + html += article.article_date + " - " + \ + """%s%s%s%s""" % \ + (feed.feed_id, article.article_id, not_read_begin, \ + article_title, not_read_end, description) + like + "
\n" + html += "
\n" + html += """All articles   """ % (feed.feed_id,) + + html += "
" + html += htmlfooter + return html + + feed.exposed = True + + def articles(self, feed_id): """ Display all articles of a feed. -- cgit