From 07d765209dea12229e70a09784e647611acabcda Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 19 Apr 2016 14:24:36 +0100 Subject: First bits of emailpusher Mostly logic of when to send an email --- synapse/push/pusher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'synapse/push/pusher.py') diff --git a/synapse/push/pusher.py b/synapse/push/pusher.py index 4960837504..f7c3021fcc 100644 --- a/synapse/push/pusher.py +++ b/synapse/push/pusher.py @@ -1,7 +1,9 @@ from httppusher import HttpPusher +from emailpusher import EmailPusher PUSHER_TYPES = { - 'http': HttpPusher + 'http': HttpPusher, + 'email': EmailPusher, } -- cgit 1.4.1 From 937c407eef78648f1c4c1afe56fdfd8598315b19 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 28 Apr 2016 15:12:14 +0100 Subject: Only import email pusher if email notifs are on --- synapse/push/pusher.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'synapse/push/pusher.py') diff --git a/synapse/push/pusher.py b/synapse/push/pusher.py index f7c3021fcc..25a45af775 100644 --- a/synapse/push/pusher.py +++ b/synapse/push/pusher.py @@ -1,12 +1,14 @@ from httppusher import HttpPusher -from emailpusher import EmailPusher - -PUSHER_TYPES = { - 'http': HttpPusher, - 'email': EmailPusher, -} def create_pusher(hs, pusherdict): + PUSHER_TYPES = { + "http": HttpPusher, + } + + if hs.config.email_enable_notifs: + from emailpusher import EmailPusher + PUSHER_TYPES["email"] = EmailPusher + if pusherdict['kind'] in PUSHER_TYPES: return PUSHER_TYPES[pusherdict['kind']](hs, pusherdict) -- cgit 1.4.1 From f1026418ea0f2dba6cc4075b737ac6fa4ffac89d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 4 May 2016 11:37:42 +0100 Subject: copyright --- synapse/push/pusher.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'synapse/push/pusher.py') diff --git a/synapse/push/pusher.py b/synapse/push/pusher.py index 25a45af775..d1eaa236bd 100644 --- a/synapse/push/pusher.py +++ b/synapse/push/pusher.py @@ -1,14 +1,36 @@ +# -*- coding: utf-8 -*- +# Copyright 2014-2016 OpenMarket Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from httppusher import HttpPusher +import logging +logger = logging.getLogger(__name__) def create_pusher(hs, pusherdict): + logger.info("trying to create_pusher for %r", pusherdict) + PUSHER_TYPES = { "http": HttpPusher, } + logger.info("email enable notifs: %r", hs.config.email_enable_notifs) if hs.config.email_enable_notifs: from emailpusher import EmailPusher PUSHER_TYPES["email"] = EmailPusher + logger.info("defined email pusher type") if pusherdict['kind'] in PUSHER_TYPES: + logger.info("found pusher") return PUSHER_TYPES[pusherdict['kind']](hs, pusherdict) -- cgit 1.4.1 From de22001ab55d7fb89e4fd1527a4b419f5c195458 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 4 May 2016 11:41:35 +0100 Subject: pep8 --- synapse/push/pusher.py | 1 + 1 file changed, 1 insertion(+) (limited to 'synapse/push/pusher.py') diff --git a/synapse/push/pusher.py b/synapse/push/pusher.py index d1eaa236bd..db5c1f1aa6 100644 --- a/synapse/push/pusher.py +++ b/synapse/push/pusher.py @@ -18,6 +18,7 @@ from httppusher import HttpPusher import logging logger = logging.getLogger(__name__) + def create_pusher(hs, pusherdict): logger.info("trying to create_pusher for %r", pusherdict) -- cgit 1.4.1 From 1cf5c379cb101c89897750d79e4548c172581f48 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 5 May 2016 01:54:12 +0100 Subject: spell out emailpusher full path --- synapse/push/pusher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'synapse/push/pusher.py') diff --git a/synapse/push/pusher.py b/synapse/push/pusher.py index db5c1f1aa6..e6c0806415 100644 --- a/synapse/push/pusher.py +++ b/synapse/push/pusher.py @@ -28,7 +28,7 @@ def create_pusher(hs, pusherdict): logger.info("email enable notifs: %r", hs.config.email_enable_notifs) if hs.config.email_enable_notifs: - from emailpusher import EmailPusher + from synapse.push.emailpusher import EmailPusher PUSHER_TYPES["email"] = EmailPusher logger.info("defined email pusher type") -- cgit 1.4.1