Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #14 from mattrobenolt/patch-1

Give priority to api_key passed through the constructor of the EmailBackend
  • Loading branch information...
commit 5e1df271b6045e72c3efb81e98f68f5eb1e05313 2 parents 86d28a3 + 366c8d1
@themartorana authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 postmark/django_backend.py
View
4 postmark/django_backend.py
@@ -32,8 +32,8 @@ def __init__(self, api_key=None, default_sender=None, **kwargs):
Initialize the backend.
"""
super(EmailBackend, self).__init__(**kwargs)
- self.api_key = getattr(settings, 'POSTMARK_API_KEY', api_key)
- if not self.api_key:
+ self.api_key = api_key if api_key is not None else getattr(settings, 'POSTMARK_API_KEY', None)
+ if self.api_key is None:
raise ImproperlyConfigured('POSTMARK API key must be set in Django settings file or passed to backend constructor.')
self.default_sender = getattr(settings, 'POSTMARK_SENDER', default_sender)
self.test_mode = getattr(settings, 'POSTMARK_TEST_MODE', False)
Please sign in to comment.
Something went wrong with that request. Please try again.