From 587e2a1df1f89879552f510253fd7c91061b99cc Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Tue, 2 Feb 2010 22:19:42 +0100 Subject: Release 0.5. Added : a link _Fetch all feeds_ manually (when you want, without cron). Improvements of the navigation. --- pyAggr3g470r.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index f91ac258..fe2ad47b 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -2,8 +2,8 @@ #-*- coding: utf-8 -*- __author__ = "Cedric Bonhomme" -__version__ = "$Revision: 0.4 $" -__date__ = "$Date: 2010/02/01 $" +__version__ = "$Revision: 0.5 $" +__date__ = "$Date: 2010/02/02 $" __copyright__ = "Copyright (c) 2010 Cedric Bonhomme" __license__ = "GPLv3" @@ -15,6 +15,8 @@ import ConfigParser from datetime import datetime from cherrypy.lib.static import serve_file +import feedgetter + config = ConfigParser.RawConfigParser() config.read("./cfg/pyAggr3g470r.cfg") path = config.get('global','path') @@ -49,9 +51,10 @@ class Root: html = htmlheader html += htmlnav html += """
\n""" + html += """Fetch all feeds\n
\n""" + html += """Management of feed\n""" html += """
\n""" - html += """Management of feed\n""" html += "
\n" html += "Your feeds:
\n" for rss_feed in self.dic.keys(): @@ -79,11 +82,19 @@ class Root: html += htmlfooter return html - def f(self): + def m(self): """ """ return "Hello world !" + def f(self): + """ + Fetch all feeds + """ + feed_getter = feedgetter.FeedGetter() + feed_getter.retrieve_feed() + return self.index() + def description(self, article_id): """ Display the description of an article in a new Web page. @@ -91,9 +102,11 @@ class Root: html = htmlheader html += htmlnav html += """
""" - for rss_feed in self.dic.keys(): - for article in self.dic[rss_feed]: + for rss_feed_id in self.dic.keys(): + for article in self.dic[rss_feed_id]: if article_id == article[0]: + html += """

%s from %s


""" % \ + (article[2].encode('utf-8'), rss_feed_id, article[5].encode('utf-8')) description = article[4].encode('utf-8') if description: html += description @@ -103,15 +116,16 @@ class Root: html += "
\n" + htmlfooter return html - def all_articles(self, feed_title): + def all_articles(self, feed_id): """ Display all articles of a feed ('feed_title'). """ html = htmlheader html += htmlnav html += """
""" + html += """

Articles of the feed %s


""" % (self.dic[feed_id][0][5].encode('utf-8')) - for article in self.dic[feed_title]: + for article in self.dic[feed_id]: html += article[1].encode('utf-8') + " - " + \ '' + article[2].encode('utf-8') + "" + \ @@ -162,6 +176,7 @@ class Root: return dic index.exposed = True + m.exposed = True f.exposed = True description.exposed = True all_articles.exposed = True -- cgit