mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
AnymailMessage: initialize anymail_status to empty AnymailStatus
Allows clients that use AnymailMessage or AnymailMessageMixin to access (e.g.) message.anymail_status.message_id without an AttributeError, even when using a non-Anymail backend (e.g., during testing). Also clarify docs of anymail_status attribute to note it only gets attached to a normal Django EmailMessage when sent through an Anymail backend. (May help with situation described in #36)
This commit is contained in:
@@ -28,7 +28,7 @@ class AnymailMessageMixin(object):
|
||||
self.template_id = kwargs.pop('template_id', UNSET)
|
||||
self.merge_data = kwargs.pop('merge_data', UNSET)
|
||||
self.merge_global_data = kwargs.pop('merge_global_data', UNSET)
|
||||
self.anymail_status = None
|
||||
self.anymail_status = AnymailStatus()
|
||||
|
||||
# noinspection PyArgumentList
|
||||
super(AnymailMessageMixin, self).__init__(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user