From d6c659b9d7fb04969b466fda28a546b154954a89 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Wed, 24 Feb 2010 21:57:33 +0100 Subject: Major enhancements. Smarter management of database. Image of feeds are retrieved. --- pyAggr3g470r.py | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 7c45cc9c..53145ee7 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -83,10 +83,12 @@ class Root: html += """\n
\n""" for rss_feed_id in self.dic.keys(): - html += '

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

\n" + html += """

%s" +

\n""" % \ + (rss_feed_id, self.dic[rss_feed_id][0][6].encode('utf-8'), \ + self.dic[rss_feed_id][0][5].encode('utf-8'), \ + self.dic_info[rss_feed_id][2].encode('utf-8')) # The main page display only 10 articles by feeds. for article in self.dic[rss_feed_id][:10]: @@ -154,19 +156,20 @@ class Root: type="submit" value="Delete all articles">\n""" html += "
\n" - html += "

Statistics

\n" - top_words = utils.top_words(self.dic, 10) - - html += "\n
" - html += "
    \n" - for word, frequency in top_words: - html += """\t
  1. %s: %s
  2. \n""" % \ - (word, word, frequency) - html += "
\n
" - utils.create_histogram(top_words) - html += """
""" + if self.dic: + html += "

Statistics

\n" + top_words = utils.top_words(self.dic, 10) + + html += "\n
" + html += "
    \n" + for word, frequency in top_words: + html += """\t
  1. %s: %s
  2. \n""" % \ + (word, word, frequency) + html += "
\n
" + utils.create_histogram(top_words) + html += """
""" + html += "
\n" - html += "
\n" html += htmlfooter return html @@ -384,13 +387,13 @@ class Root: c = conn.cursor() # Mark all articles as read. if param == "All": - c.execute("UPDATE rss_feed SET article_readed=1") + c.execute("UPDATE articles SET article_readed=1") # Mark all articles from a feed as read. elif param == "Feed" or param == "Feed_FromMainPage": - c.execute("UPDATE rss_feed SET article_readed=1 WHERE feed_site_link='" + self.dic[identifiant][0][6] + "'") + c.execute("UPDATE articles SET article_readed=1 WHERE feed_site_link='" + self.dic[identifiant][0][6] + "'") # Mark an article as read. elif param == "Article": - c.execute("UPDATE rss_feed SET article_readed=1 WHERE article_link='" + identifiant + "'") + c.execute("UPDATE articles SET article_readed=1 WHERE article_link='" + identifiant + "'") conn.commit() c.close() except Exception, e: -- cgit