aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-01-21 23:24:07 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-01-21 23:24:07 +0100
commit53918bd9c3f4b8c5946ba7aea8fe16c7ab9844d9 (patch)
tree606a69cf70e71837b874fa954e32be0e2fe5c382
parentTest if the article is present in the database before sending it via mail. (diff)
downloadnewspipe-53918bd9c3f4b8c5946ba7aea8fe16c7ab9844d9.tar.gz
newspipe-53918bd9c3f4b8c5946ba7aea8fe16c7ab9844d9.tar.bz2
newspipe-53918bd9c3f4b8c5946ba7aea8fe16c7ab9844d9.zip
Added a new option to specify if e-mail notification is activated.
-rwxr-xr-xsource/cfg/pyAggr3g470r.cfg-sample1
-rw-r--r--source/conf.py1
-rwxr-xr-xsource/feedgetter.py2
3 files changed, 3 insertions, 1 deletions
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, \
bgstack15