Skip to content

Commit

Permalink
Merge pull request #66 from ilstreltsov/getting-mail-provider
Browse files Browse the repository at this point in the history
Getting mail provider
  • Loading branch information
gotlium authored Sep 14, 2016
2 parents 30843d8 + 439b619 commit 603c7e6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dbmail/backends/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@


class Sender(object):
provider = defaults.MAIL_PROVIDER

def __init__(self, slug, recipient, *args, **kwargs):
self._slug = slug

Expand All @@ -35,7 +37,7 @@ def __init__(self, slug, recipient, *args, **kwargs):
self._user = kwargs.pop('user', None)
self._language = kwargs.pop('language', None)
self._backend = kwargs.pop('backend')
self._provider = kwargs.pop('provider', None)
self._provider = kwargs.pop('provider', self.provider)
self._signals_kw = kwargs.pop('signals_kwargs', {})

self._template = self._get_template()
Expand Down
1 change: 0 additions & 1 deletion dbmail/backends/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def _send(self):
if self._from_email:
options['app'] = self._from_email

self._provider = self._provider or self.provider
module = import_module(self._provider)

for address in self._recipient_list:
Expand Down
1 change: 0 additions & 1 deletion dbmail/backends/sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def _get_recipient_list(self, recipient):
return self._email_to_list(recipient)

def _send(self):
self._provider = self._provider or self.provider
module = import_module(self._provider)
message = clean_html(self._message)
for phone in self._recipient_list:
Expand Down
2 changes: 2 additions & 0 deletions dbmail/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def get_settings(key, default):
'DB_MAILER_TTS_PROVIDER', 'dbmail.providers.nexmo.tts')
PUSH_PROVIDER = get_settings(
'DB_MAILER_PUSH_PROVIDER', 'dbmail.providers.prowl.push')
MAIL_PROVIDER = get_settings('DB_MAILER_MAIL_PROVIDER', None)

SAFARI_PUSH_PATH = get_settings(
'DB_MAILER_SAFARI_PUSH_PATH', settings.STATIC_ROOT or '.')

Expand Down

0 comments on commit 603c7e6

Please sign in to comment.