Mandrill requires template_content field for send-template.

Fixes #47.
This commit is contained in:
medmunds
2013-10-19 11:41:20 -07:00
parent 43dd289a16
commit f565a4c294
2 changed files with 3 additions and 4 deletions

View File

@@ -76,9 +76,8 @@ class DjrillBackend(BaseEmailBackend):
if hasattr(message, 'template_name'):
api_url = self.api_send_template
api_params['template_name'] = message.template_name
if hasattr(message, 'template_content'):
api_params['template_content'] = \
self._expand_merge_vars(message.template_content)
api_params['template_content'] = \
self._expand_merge_vars(getattr(message, 'template_content', {}))
response = requests.post(api_url, data=json.dumps(api_params))

View File

@@ -36,7 +36,7 @@ class DjrillMandrillSendTemplateTests(DjrillBackendMockAPITestCase):
self.assert_mandrill_called("/messages/send-template.json")
data = self.get_api_call_data()
self.assertEqual(data['template_name'], "WELCOME_MESSAGE")
self.assertFalse('template_content' in data)
self.assertEqual(data['template_content'], []) # Mandrill requires this field
def test_non_template_send(self):
# Make sure the non-template case still uses /messages/send.json