From de9df587edfede9d54722e6bbadf7b63af26fd43 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 2 Feb 2013 21:04:02 +0100 Subject: The id of the feed is used as key of the dictionary. --- source/pyAggr3g470r.py | 8 ++++---- source/templates/languages.html | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 62e117b7..d61d4e73 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -468,11 +468,11 @@ class pyAggr3g470r(object): language = guess_language(utils.clear_string(article["article_content"])) if language not in result.keys(): result[language] = {} - if feed["feed_title"] not in result[language].keys(): - result[language][feed["feed_title"]] = [] - result[language][feed["feed_title"]].append(article) + if feed["feed_id"] not in result[language].keys(): + result[language][feed["feed_id"]] = [] + result[language][feed["feed_id"]].append(article) tmpl = lookup.get_template("languages.html") - return tmpl.render(articles_sorted_by_languages=result) + return tmpl.render(articles_sorted_by_languages=result, mongo=self.mongo) languages.exposed = True diff --git a/source/templates/languages.html b/source/templates/languages.html index 8d0ff3ce..46266e98 100644 --- a/source/templates/languages.html +++ b/source/templates/languages.html @@ -8,10 +8,13 @@ %for language in articles_sorted_by_languages.keys():

${language}

- %for feed in articles_sorted_by_languages[language]: -

${feed}

- %for article in articles_sorted_by_languages[language][feed]: - ${article["article_date"].strftime('%Y-%m-%d %H:%M')} - ${article["article_title"]} + %for feed_id in articles_sorted_by_languages[language]: + <% + feed = mongo.get_feed(feed_id) + %> +

${feed["feed_title"]}

+ %for article in articles_sorted_by_languages[language][feed_id]: + ${article["article_date"].strftime('%Y-%m-%d %H:%M')} - ${article["article_title"]}
%endfor
-- cgit