From ad17f49157b8c255d5b289b4c73a8cdd37a30436 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Sat, 6 Feb 2010 20:38:27 +0100 Subject: Improvement. Tuple are remplaced by list of articles in order to update self.dic faster (without having to reload from the database). --- pyAggr3g470r.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index a446ca0b..d96be7db 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -87,8 +87,8 @@ class Root: not_read_end = "" html += article[1].encode('utf-8') + \ - not_read_begin + \ - """ - %s""" % \ + " - " + not_read_begin + \ + """%s""" % \ (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ not_read_end + \ "
\n" @@ -130,7 +130,7 @@ class Root: if article[7] == "0": self.mark_as_read(article[3]) # update the database - article[7] == 1 # avoids to reload self.dic + article[7] = "1" # avoids to reload self.dic html += """

%s from %s


""" % \ (article[2].encode('utf-8'), rss_feed_id, article[5].encode('utf-8')) @@ -163,8 +163,8 @@ class Root: not_read_end = "" html += article[1].encode('utf-8') + \ - not_read_begin + \ - """ - %s""" % \ + " - " + not_read_begin + \ + """%s""" % \ (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ not_read_end + \ "
\n" @@ -225,13 +225,13 @@ class Root: sha256_hash.update(article[2].encode('utf-8')) article_id = sha256_hash.hexdigest() - article_tuple = (article_id, article[0], article[1], \ - article[2], article[3], article[4], article[5], article[6]) + article_list = [article_id, article[0], article[1], \ + article[2], article[3], article[4], article[5], article[6]] if feed_id not in dic: - dic[feed_id] = [article_tuple] + dic[feed_id] = [article_list] else: - dic[feed_id].append(article_tuple) + dic[feed_id].append(article_list) # sort articles by date for each feeds for feeds in dic.keys(): -- cgit