Browse files

If an api_key is passed through the EmailBackend constructor, it shou…

…ld take priority over the global settings.POSTMARK_API_KEY. Without this, you are not able to override the global variable for a one-off call.
  • Loading branch information...
1 parent c96c3af commit 366c8d18f30ca991ab9ad3ed1fcd826a887f0db0 @mattrobenolt mattrobenolt committed Jun 16, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 postmark/
4 postmark/
@@ -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)

0 comments on commit 366c8d1

Please sign in to comment.