From 3cb9f9054b379533e1b2dd31810af37a3098f0e7 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Mon, 25 Oct 2010 09:51:31 +0200 Subject: Added comments. Cleaner code. --- pyAggr3g470r.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index aeeb63f7..1d1d9f89 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -110,6 +110,7 @@ class Root: """ Main page containing the list of feeds and articles. """ + # if there are unread articles, display the number in the tab html = htmlheader((self.nb_unread_articles and \ ['(' + str(self.nb_unread_articles) +') '] or \ [""])[0]) @@ -152,11 +153,13 @@ class Root: not_read_begin = "" not_read_end = "" + # display a heart for faved articles if article[7] == "1": like = """ """ else: like = "" + # title of the article html += article[1].encode('utf-8') + \ " - " + not_read_begin + \ """%s""" % \ @@ -165,6 +168,7 @@ class Root: "
\n" html += "
\n" + # some options for the current feed html += """All articles   """ % (rss_feed_id,) html += """  Mark all as read""" % (rss_feed_id,) if self.feeds[rss_feed_id][1] != 0: @@ -195,6 +199,7 @@ class Root: html += """
\n""" html += "
\n" + # insert the list of feeds in the menu html += self.create_list_of_feeds() html += "\n" @@ -248,32 +253,37 @@ class Root: (self.nb_favorites, ) html += "
\n" + + # Informations about the data base of articles, export funtions... html += """

The database contains a total of %s article(s) with %s unread article(s).
""" % \ (self.nb_articles, self.nb_unread_articles) html += """Database: %s.\n
Size: %s bytes.

\n""" % \ (os.path.abspath(utils.sqlite_base), os.path.getsize(utils.sqlite_base)) - html += """
\n
\n""" - html += """
\n
\n""" - html += "

Export articles

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

Export articles

\n\n" html += """
\n""" - html += "
\n" + html += "
\n\n" + + # Some statistics if self.articles: self.top_words = utils.top_words(self.articles, n=50, size=int(word_size)) html += "

Statistics

\n
\n" if "oice" not in utils.IMPORT_ERROR: + # counter object to count the number of + # french and english articles counter = Counter() for rss_feed_id in self.articles.keys(): for article in self.articles[rss_feed_id]: counter[article[6]] += 1 + # Tags cloud html += "Minimum size of a word: " html += """