django-mail-templated
django-mail-templated copied to clipboard
Raise nice error if not inheriting from the base template
If I forget to inherit from the base template provided with django-mail-templated, I'll get some cryptic error like this:
Traceback (most recent call last):
File "mail_templated/message.py", line 227, in send
return super(EmailMessage, self).send(*args, **kwargs)
File "django/core/mail/message.py", line 292, in send
return self.get_connection(fail_silently).send_messages([self])
File "django/core/mail/backends/locmem.py", line 26, in send_messages
message.message()
File "django/core/mail/message.py", line 255, in message
msg = SafeMIMEText(self.body, self.content_subtype, encoding)
File "django/core/mail/message.py", line 171, in __init__
MIMEText.__init__(self, _text, _subtype, None)
File "email/mime/text.py", line 34, in __init__
_text.encode('us-ascii')
AttributeError: 'NoneType' object has no attribute 'encode'
This should be caught earlier if possible and turned into a nice error message.
Thanks for the note. This definitely should be implemented.