From 1e80c3ec37bd0c91557ce05b296aa4987c541fa9 Mon Sep 17 00:00:00 2001 From: medmunds Date: Wed, 9 Mar 2016 18:47:42 -0800 Subject: [PATCH] Invert unsupported-features setting Change from UNSUPPORTED_FEATURE_ERRORS (default True) to IGNORE_UNSUPPORTED_FEATURES (default False). Parallels IGNORE_RECIPIENT_STATUS. --- anymail/backends/base.py | 4 ++-- docs/installation.rst | 6 +++--- docs/sending/django_email.rst | 8 ++++---- docs/sending/exceptions.rst | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/anymail/backends/base.py b/anymail/backends/base.py index 221b68f..bcb7219 100644 --- a/anymail/backends/base.py +++ b/anymail/backends/base.py @@ -17,7 +17,7 @@ class AnymailBaseBackend(BaseEmailBackend): def __init__(self, *args, **kwargs): super(AnymailBaseBackend, self).__init__(*args, **kwargs) - self.unsupported_feature_errors = get_anymail_setting("UNSUPPORTED_FEATURE_ERRORS", True) + self.ignore_unsupported_features = get_anymail_setting("IGNORE_UNSUPPORTED_FEATURES", False) self.ignore_recipient_status = get_anymail_setting("IGNORE_RECIPIENT_STATUS", False) # Merge SEND_DEFAULTS and _SEND_DEFAULTS settings @@ -227,7 +227,7 @@ class BasePayload(object): setter(value) def unsupported_feature(self, feature): - if self.backend.unsupported_feature_errors: + if not self.backend.ignore_unsupported_features: raise AnymailUnsupportedFeature("%s does not support %s" % (self.esp_name, feature), email_message=self.message, payload=self, backend=self.backend) diff --git a/docs/installation.rst b/docs/installation.rst index 22987ab..56aed19 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -159,9 +159,9 @@ A `dict` of default options to apply to all messages sent through Anymail. See :ref:`send-defaults`. -.. rubric:: UNSUPPORTED_FEATURE_ERRORS +.. rubric:: IGNORE_UNSUPPORTED_FEATURES Whether Anymail should raise :exc:`~anymail.exceptions.AnymailUnsupportedFeature` errors for email with features that can't be accurately communicated to the ESP. -Set to `False` to ignore these problems and send the email anyway. See -:ref:`unsupported-features`. (Default `True`.) +Set to `True` to ignore these problems and send the email anyway. See +:ref:`unsupported-features`. (Default `False`.) diff --git a/docs/sending/django_email.rst b/docs/sending/django_email.rst index 2609188..bb98550 100644 --- a/docs/sending/django_email.rst +++ b/docs/sending/django_email.rst @@ -116,17 +116,17 @@ For example, very few ESPs support alternative message parts added with If you try to send a message with other alternative parts, Anymail will raise :exc:`~exceptions.AnymailUnsupportedFeature`. -.. setting:: ANYMAIL_UNSUPPORTED_FEATURE_ERRORS +.. setting:: ANYMAIL_IGNORE_UNSUPPORTED_FEATURES If you'd like to silently ignore :exc:`~exceptions.AnymailUnsupportedFeature` -errors and send the messages anyway, set :setting:`!ANYMAIL_UNSUPPORTED_FEATURE_ERRORS` -to `False` in your settings.py: +errors and send the messages anyway, set :setting:`!ANYMAIL_IGNORE_UNSUPPORTED_FEATURES` +to `True` in your settings.py: .. code-block:: python ANYMAIL = { ... - "UNSUPPORTED_FEATURE_ERRORS": False, + "IGNORE_UNSUPPORTED_FEATURES": True, } diff --git a/docs/sending/exceptions.rst b/docs/sending/exceptions.rst index d38f1a7..a4fe548 100644 --- a/docs/sending/exceptions.rst +++ b/docs/sending/exceptions.rst @@ -8,12 +8,12 @@ Exceptions .. exception:: AnymailUnsupportedFeature If the email tries to use features that aren't supported by the ESP, the send - call will raise an :exc:`!AnymailUnsupportedFeature` error (a subclass - of :exc:`ValueError`), and the message won't be sent. + call will raise an :exc:`!AnymailUnsupportedFeature` error, and the message + won't be sent. See :ref:`unsupported-features`. You can disable this exception (ignoring the unsupported features and sending the message anyway, without them) by setting - :setting:`ANYMAIL_UNSUPPORTED_FEATURE_ERRORS` to ``False``. + :setting:`ANYMAIL_IGNORE_UNSUPPORTED_FEATURES` to `True`. .. exception:: AnymailRecipientsRefused