Only import email pusher if email notifs are on

This commit is contained in:
David Baker 2016-04-28 15:12:14 +01:00
parent ebbabc4986
commit 937c407eef
1 changed files with 8 additions and 6 deletions

View File

@ -1,12 +1,14 @@
from httppusher import HttpPusher from httppusher import HttpPusher
from emailpusher import EmailPusher
PUSHER_TYPES = {
'http': HttpPusher,
'email': EmailPusher,
}
def create_pusher(hs, pusherdict): 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: if pusherdict['kind'] in PUSHER_TYPES:
return PUSHER_TYPES[pusherdict['kind']](hs, pusherdict) return PUSHER_TYPES[pusherdict['kind']](hs, pusherdict)