From fd8465eb1cdf9b520f3c80e9e561a644a508c0cb Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Tue, 27 May 2014 12:18:40 +0200 Subject: [PATCH] warn about incorrect notification backends, fix #95 SMTP is now also recognized as `smtp`backend. You may use multiple notification backends (separated by comma). Defaults to `stdout`. --- docs/docs/configuration/server.rst | 13 ++++++++++--- isso/__init__.py | 11 +++++++---- isso/core.py | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/docs/configuration/server.rst b/docs/docs/configuration/server.rst index 45f2f79..4041813 100644 --- a/docs/docs/configuration/server.rst +++ b/docs/docs/configuration/server.rst @@ -43,7 +43,7 @@ session key and hostname. Here are the default values for this section: name = host = max-age = 15m - notify = + notify = stdout dbpath file location to the SQLite3 database, highly recommended to change this @@ -76,8 +76,15 @@ max-age :ref:`Appendum: Timedelta ` for valid values. notify - Select notification backend for new comments. Currently, only SMTP - is available. + Select notification backend(s) for new comments, separated by comma. + Available backends: + + stdout : + Log to standard output. Default, if none selected. + + smtp : + Send notifications via SMTP on new comments with activation (if + moderated) and deletion links. .. _CORS: https://developer.mozilla.org/en/docs/HTTP/Access_control_CORS diff --git a/isso/__init__.py b/isso/__init__.py index 7f4f4d0..9313d24 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -92,10 +92,13 @@ class Isso(object): super(Isso, self).__init__(conf) subscribers = [] - subscribers.append(Stdout(None)) - - if conf.get("general", "notify") == "smtp": - subscribers.append(SMTP(self)) + for backend in conf.getlist("general", "notify"): + if backend == "stdout": + subscribers.append(Stdout(None)) + elif backend in ("smtp", "SMTP"): + subscribers.append(SMTP(self)) + else: + logger.warn("unknown notification backend '%s'", backend) self.signal = ext.Signal(*subscribers) diff --git a/isso/core.py b/isso/core.py index 30d2564..4e30f49 100644 --- a/isso/core.py +++ b/isso/core.py @@ -95,7 +95,7 @@ class Config: "dbpath = /tmp/isso.db", "host = ", "max-age = 15m", - "notify = ", + "notify = stdout", "[moderation]", "enabled = false", "purge-after = 30d",