From 44046b71ed517eb56d210bf57caf854d23ceb2af Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Sat, 6 Mar 2010 20:06:01 +0100 Subject: Improvement of display of description of article. Now articles are search by article_id AND feed_id. --- pyAggr3g470r.py | 114 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 56 insertions(+), 58 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index ed8e86f7..eb9e7956 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -109,8 +109,8 @@ class Root: html += article[1].encode('utf-8') + \ " - " + not_read_begin + \ - """%s""" % \ - (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ + """%s""" % \ + (rss_feed_id, article[0].encode('utf-8'),article[2].encode('utf-8')) + \ not_read_end + \ "
\n" html += "
\n" @@ -270,64 +270,62 @@ class Root: fetch.exposed = True - def description(self, article_id): + def description(self, param): """ Display the description of an article in a new Web page. """ + feed_id, article_id = param.split(':') html = htmlheader html += htmlnav html += """
""" - for rss_feed_id in self.articles.keys(): - for article in self.articles[rss_feed_id]: - if article_id == article[0]: + for article in self.articles[feed_id]: + if article_id == article[0]: - if article[5] == "0": - self.mark_as_read("Article:"+article[3]) # update the database + if article[5] == "0": + self.mark_as_read("Article:"+article[3]) # update the database - html += """

%s from %s

\n
\n""" % \ - (article[2].encode('utf-8'), rss_feed_id, \ - self.feeds[rss_feed_id][3].encode('utf-8')) - description = article[4].encode('utf-8') - if description: - html += description - else: - html += "No description available." - html += "\n
\n" - html += """This article seems to be written in %s.\n""" % \ - (article[6], article[6]) - html += """
\nPlain text\n""" % \ - (rss_feed_id, article_id) - html += """
\nComplete story\n
\n""" % \ - (article[3].encode('utf-8'),) - # Share this article: - # on delicious - html += """\n -    """ % \ - (article[3].encode('utf-8'), article[2].encode('utf-8')) - # on Digg - html += """\n -    """ % \ - (article[3].encode('utf-8'), article[2].encode('utf-8')) - # on reddit - html += """\n -    """ % \ - (article[3].encode('utf-8'), article[2].encode('utf-8')) - # on Scoopeo - html += """\n -    """ % \ - (article[3].encode('utf-8'), article[2].encode('utf-8')) - # on Blogmarks - html += """\n - """ % \ - (article[3].encode('utf-8'), article[2].encode('utf-8')) - break - else: - continue + html += """

%s from %s

\n
\n""" % \ + (article[2].encode('utf-8'), feed_id, \ + self.feeds[feed_id][3].encode('utf-8')) + description = article[4].encode('utf-8') + if description: + html += description + else: + html += "No description available." + html += "\n
\n" + html += """This article seems to be written in %s.\n""" % \ + (article[6], article[6]) + html += """
\nPlain text\n""" % \ + (feed_id, article_id) + html += """
\nComplete story\n
\n""" % \ + (article[3].encode('utf-8'),) + # Share this article: + # on delicious + html += """\n +    """ % \ + (article[3].encode('utf-8'), article[2].encode('utf-8')) + # on Digg + html += """\n +    """ % \ + (article[3].encode('utf-8'), article[2].encode('utf-8')) + # on reddit + html += """\n +    """ % \ + (article[3].encode('utf-8'), article[2].encode('utf-8')) + # on Scoopeo + html += """\n +    """ % \ + (article[3].encode('utf-8'), article[2].encode('utf-8')) + # on Blogmarks + html += """\n + """ % \ + (article[3].encode('utf-8'), article[2].encode('utf-8')) + break html += "
\n" + htmlfooter return html @@ -368,8 +366,8 @@ class Root: html += article[1].encode('utf-8') + \ " - " + not_read_begin + \ - """%s""" % \ - (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ + """%s""" % \ + (feed_id, article[0].encode('utf-8'), article[2].encode('utf-8')) + \ not_read_end + \ "
\n" @@ -395,9 +393,9 @@ class Root: for article in self.articles[rss_feed_id]: if article[5] == "0": html += article[1].encode('utf-8') + \ - """ - %s + """ - %s from %s
\n""" % \ - (article[0].encode('utf-8'), article[2].encode('utf-8'), \ + (rss_feed_id, article[0].encode('utf-8'), article[2].encode('utf-8'), \ self.feeds[rss_feed_id][5].encode('utf-8'), \ self.feeds[rss_feed_id][3].encode('utf-8')) html += """
\nMark articles as read\n""" @@ -407,8 +405,8 @@ class Root: for article in self.articles[feed_id]: if article[5] == "0": html += article[1].encode('utf-8') + \ - """ - %s""" % \ - (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ + """ - %s""" % \ + (feed_id, article[0].encode('utf-8'), article[2].encode('utf-8')) + \ "
\n" html += """
\nMark all as read""" % (feed_id,) -- cgit