SendGrid: Improve esp_extra["personalizations"] handling.

Allow merging `esp_extra["personalizations"]` dict into other
message-derived personalizations.

(See comments in #120)
This commit is contained in:
medmunds
2018-08-27 11:10:48 -07:00
parent dbca13243f
commit 382ebf249c
4 changed files with 48 additions and 1 deletions

View File

@@ -123,6 +123,12 @@ Your :attr:`esp_extra` dict will be deeply merged into the
parameters Anymail has constructed for the send, with `esp_extra`
having precedence in conflicts.
Anymail has special handling for `esp_extra["personalizations"]`. If that value
is a `dict`, Anymail will merge that personalizations dict into the personalizations
for each message recipient. (If you pass a `list`, that will override the
personalizations Anymail normally constructs from the message, and you will need to
specify each recipient in the personalizations list yourself.)
Example:
.. code-block:: python
@@ -140,6 +146,11 @@ Example:
"substitution_tag": "%%OPEN_TRACKING_PIXEL%%",
},
},
# Because "personalizations" is a dict, Anymail will merge "future_feature"
# into the SendGrid personalizations array for each message recipient
"personalizations": {
"future_feature": {"future": "data"},
},
}