From 53918bd9c3f4b8c5946ba7aea8fe16c7ab9844d9 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 21 Jan 2013 23:24:07 +0100 Subject: Added a new option to specify if e-mail notification is activated. --- source/cfg/pyAggr3g470r.cfg-sample | 1 + source/conf.py | 1 + source/feedgetter.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/cfg/pyAggr3g470r.cfg-sample b/source/cfg/pyAggr3g470r.cfg-sample index a4ac86fb..26d773ef 100755 --- a/source/cfg/pyAggr3g470r.cfg-sample +++ b/source/cfg/pyAggr3g470r.cfg-sample @@ -5,6 +5,7 @@ dbname = bob_pyaggr3g470r user = bob password = password_of_bob [mail] +enabled = 0 mail_from = pyAggr3g470r@no-reply.com mail_to = address_of_the_recipient@example.com smtp = smtp.example.com diff --git a/source/conf.py b/source/conf.py index e89f0090..18ff0259 100644 --- a/source/conf.py +++ b/source/conf.py @@ -43,6 +43,7 @@ MONGODB_DBNAME = config.get('MongoDB', 'dbname') MONGODB_USER = config.get('MongoDB', 'user') MONGODB_PASSWORD = config.get('MongoDB', 'password') +MAIL_ENABLED = bool(config.get('mail','enabled')) mail_from = config.get('mail','mail_from') mail_to = config.get('mail','mail_to') smtp_server = config.get('mail','smtp') diff --git a/source/feedgetter.py b/source/feedgetter.py index 84dd2f47..bd35e345 100755 --- a/source/feedgetter.py +++ b/source/feedgetter.py @@ -155,7 +155,7 @@ class FeedGetter(object): articles.append(article) - if feed["mail"] and self.articles.get_articles(feed_id, article_id) == False: + if conf.MAIL_ENABLED and feed["mail"] and self.articles.get_articles(feed_id, article_id) == False: # if subscribed to the feed AND if article not already in the database threading.Thread(None, utils.send_mail, None, (conf.mail_from, conf.mail_to, \ a_feed.feed.title, \ -- cgit