Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 366c8d18f30ca991ab9ad3ed1fcd826a887f0db0 1 parent c96c3af
@mattrobenolt mattrobenolt 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.