From 46e2ce90f6d172e9b6c5d05f1863884a62678a68 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Tue, 2 Feb 2010 09:14:29 +0100 Subject: Minor enhancements. --- pyAggr3g470r.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 923ef9c4..9bee7d7b 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -31,7 +31,8 @@ htmlheader = """\n\n pyAggr3g470r - RSS Feed Reader """ -htmlfooter = """This software is under GPLv3 license. +htmlfooter = """This software is under GPLv3 license. You are welcome to copy, modify or + redistribute the source code according to the GPLv3 license. """ htmlnav = """

pyAggr3g470r - RSS Feed Reader

\n
\n""" - for rss_feed in self.dic.keys(): - html += '

' + \ - '' + self.dic[rss_feed][0][5].encode('utf-8') + "

\n" + for rss_feed_id in self.dic.keys(): + html += '

' + \ + '' + self.dic[rss_feed_id][0][5].encode('utf-8') + "

\n" # The main page display only 10 articles by feeds. - for article in self.dic[rss_feed][:10]: + for article in self.dic[rss_feed_id][:10]: html += article[1].encode('utf-8') + " - " + \ '' + article[2].encode('utf-8') + "" + \ @@ -72,7 +73,7 @@ class Root: "
\n" html += "
\n" - html += """[All articles]""" % (rss_feed,) + html += """[All articles]""" % (rss_feed_id,) html += """

Top

""" html += "
\n" html += htmlfooter @@ -93,9 +94,13 @@ class Root: for rss_feed in self.dic.keys(): for article in self.dic[rss_feed]: if article_id == article[0]: - html += article[4].encode('utf-8') - html += """
\nComplete story""" % (article[3].encode('utf-8'),) - html += "
" + htmlfooter + description = article[4].encode('utf-8') + if description: + html += description + else: + html += "No description available." + html += """
\nComplete story\n""" % (article[3].encode('utf-8'),) + html += "
\n" + htmlfooter return html def all_articles(self, feed_title): @@ -113,7 +118,8 @@ class Root: """ - [description]""" % (article[0].encode('utf-8'),) + \ "
\n" - html += """

All feeds

""" + html += """
\n

All feeds

""" + html += "
\n" html += htmlfooter return html @@ -130,8 +136,8 @@ class Root: except: pass - # The key of dic is the title of the feed: - # dic[feed_title] = (article_id, article_date, article_title, article_link, article_description, feed_title, feed_link) + # The key of dic is the id of the feed: + # dic[feed_if] = (article_id, article_date, article_title, article_link, article_description, feed_title, feed_link) dic = {} if list_of_articles is not None: for article in list_of_articles: @@ -186,5 +192,6 @@ def compare(stringtime1, stringtime2): if __name__ == '__main__': + # Point of entry in execution mode root = Root() cherrypy.quickstart(root, config=path) \ No newline at end of file -- cgit