From 80b82644ac7c41d1a8b8bd2b3f272ee91fcba2d0 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Tue, 23 Mar 2010 18:54:46 +0100 Subject: Release 1.0. Mail notification. A lot of improvements and some bug fix. --- feedgetter.py | 6 +++++- pyAggr3g470r.py | 14 +++++++------- utils.py | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/feedgetter.py b/feedgetter.py index 36495b43..5239dd2a 100755 --- a/feedgetter.py +++ b/feedgetter.py @@ -4,7 +4,7 @@ from __future__ import with_statement __author__ = "Cedric Bonhomme" -__version__ = "$Revision: 0.7 $" +__version__ = "$Revision: 0.8 $" __date__ = "$Date: 2010/03/01 $" __copyright__ = "Copyright (c) 2010 Cedric Bonhomme" __license__ = "GPLv3" @@ -128,6 +128,10 @@ class FeedGetter(object): # send the article utils.send_mail(utils.mail_from, utils.mail_to, \ a_feed.feed.title.encode('utf-8'), description) + threading.Thread(None, utils.send_mail, \ + None, (utils.mail_from, utils.mail_to, \ + a_feed.feed.title.encode('utf-8'), description) \ + ) except sqlite3.IntegrityError: # article already in the base pass diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index c7b2e94f..a9d6af8f 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -2,7 +2,7 @@ #-*- coding: utf-8 -*- __author__ = "Cedric Bonhomme" -__version__ = "$Revision: 0.9 $" +__version__ = "$Revision: 1.0 $" __date__ = "$Date: 2010/03/01 $" __copyright__ = "Copyright (c) 2010 Cedric Bonhomme" __license__ = "GPLv3" @@ -114,15 +114,15 @@ class Root: html += "
\n" html += """All articles""" % (rss_feed_id,) - if self.feeds[rss_feed_id][6] == "0": - html += """ Stay tuned""" % (rss_feed_id,) - else: - html += """ Stop staying tuned""" % (rss_feed_id,) html += """ Mark all as read""" % (rss_feed_id,) if self.feeds[rss_feed_id][1] != 0: html += """ Unread article(s) (%s)""" % (rss_feed_id, \ self.feeds[rss_feed_id][1]) + if self.feeds[rss_feed_id][6] == "0": + html += """
\nStay tuned""" % (rss_feed_id,) + else: + html += """
\nStop staying tuned""" % (rss_feed_id,) html += """

Top

""" html += "
\n" html += htmlfooter @@ -553,7 +553,7 @@ class Root: mark_as_read.exposed = True - def tuned(self, param): + def mail_notification(self, param): """ Enable or disable to notifications of news for a feed. """ @@ -579,7 +579,7 @@ class Root: c.close() return self.index() - tuned.exposed = True + mail_notification.exposed = True def update(self, path=None, event = None): diff --git a/utils.py b/utils.py index 25031317..9fafe634 100755 --- a/utils.py +++ b/utils.py @@ -2,7 +2,7 @@ #-*- coding: utf-8 -*- __author__ = "Cedric Bonhomme" -__version__ = "$Revision: 0.3 $" +__version__ = "$Revision: 0.4 $" __date__ = "$Date: 2010/03/10 $" __copyright__ = "Copyright (c) 2010 Cedric Bonhomme" __license__ = "GPLv3" @@ -176,7 +176,7 @@ def create_base(): Create the base if not exists. """ sqlite3.register_adapter(str, lambda s : s.decode('utf-8')) - conn = sqlite3.connect("./var/feed.db", isolation_level = None) + conn = sqlite3.connect(sqlite_base, isolation_level = None) c = conn.cursor() c.execute('''create table if not exists feeds (feed_title text, feed_site_link text, \ @@ -197,7 +197,7 @@ def load_feed(): list_of_feeds = [] list_of_articles = [] try: - conn = sqlite3.connect("./var/feed.db", isolation_level = None) + conn = sqlite3.connect(sqlite_base, isolation_level = None) c = conn.cursor() list_of_feeds = c.execute("SELECT * FROM feeds").fetchall() except: -- cgit