Invert unsupported-features setting

Change from UNSUPPORTED_FEATURE_ERRORS
(default True) to IGNORE_UNSUPPORTED_FEATURES
(default False). Parallels IGNORE_RECIPIENT_STATUS.
This commit is contained in:
medmunds
2016-03-09 18:47:42 -08:00
parent 20c6350140
commit 1e80c3ec37
4 changed files with 12 additions and 12 deletions

View File

@@ -17,7 +17,7 @@ class AnymailBaseBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(AnymailBaseBackend, self).__init__(*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) self.ignore_recipient_status = get_anymail_setting("IGNORE_RECIPIENT_STATUS", False)
# Merge SEND_DEFAULTS and <esp_name>_SEND_DEFAULTS settings # Merge SEND_DEFAULTS and <esp_name>_SEND_DEFAULTS settings
@@ -227,7 +227,7 @@ class BasePayload(object):
setter(value) setter(value)
def unsupported_feature(self, feature): 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), raise AnymailUnsupportedFeature("%s does not support %s" % (self.esp_name, feature),
email_message=self.message, payload=self, backend=self.backend) email_message=self.message, payload=self, backend=self.backend)

View File

@@ -159,9 +159,9 @@ A `dict` of default options to apply to all messages sent through Anymail.
See :ref:`send-defaults`. See :ref:`send-defaults`.
.. rubric:: UNSUPPORTED_FEATURE_ERRORS .. rubric:: IGNORE_UNSUPPORTED_FEATURES
Whether Anymail should raise :exc:`~anymail.exceptions.AnymailUnsupportedFeature` Whether Anymail should raise :exc:`~anymail.exceptions.AnymailUnsupportedFeature`
errors for email with features that can't be accurately communicated to the ESP. 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 Set to `True` to ignore these problems and send the email anyway. See
:ref:`unsupported-features`. (Default `True`.) :ref:`unsupported-features`. (Default `False`.)

View File

@@ -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 If you try to send a message with other alternative parts, Anymail will
raise :exc:`~exceptions.AnymailUnsupportedFeature`. raise :exc:`~exceptions.AnymailUnsupportedFeature`.
.. setting:: ANYMAIL_UNSUPPORTED_FEATURE_ERRORS .. setting:: ANYMAIL_IGNORE_UNSUPPORTED_FEATURES
If you'd like to silently ignore :exc:`~exceptions.AnymailUnsupportedFeature` If you'd like to silently ignore :exc:`~exceptions.AnymailUnsupportedFeature`
errors and send the messages anyway, set :setting:`!ANYMAIL_UNSUPPORTED_FEATURE_ERRORS` errors and send the messages anyway, set :setting:`!ANYMAIL_IGNORE_UNSUPPORTED_FEATURES`
to `False` in your settings.py: to `True` in your settings.py:
.. code-block:: python .. code-block:: python
ANYMAIL = { ANYMAIL = {
... ...
"UNSUPPORTED_FEATURE_ERRORS": False, "IGNORE_UNSUPPORTED_FEATURES": True,
} }

View File

@@ -8,12 +8,12 @@ Exceptions
.. exception:: AnymailUnsupportedFeature .. exception:: AnymailUnsupportedFeature
If the email tries to use features that aren't supported by the ESP, the send 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 call will raise an :exc:`!AnymailUnsupportedFeature` error, and the message
of :exc:`ValueError`), and the message won't be sent. won't be sent. See :ref:`unsupported-features`.
You can disable this exception (ignoring the unsupported features and You can disable this exception (ignoring the unsupported features and
sending the message anyway, without them) by setting sending the message anyway, without them) by setting
:setting:`ANYMAIL_UNSUPPORTED_FEATURE_ERRORS` to ``False``. :setting:`ANYMAIL_IGNORE_UNSUPPORTED_FEATURES` to `True`.
.. exception:: AnymailRecipientsRefused .. exception:: AnymailRecipientsRefused