-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: remove duplicate emails ignoring case in Personalization #924
feat: remove duplicate emails ignoring case in Personalization #924
Conversation
The setters currently don't work for lists of strings or lists of tuples. Wasn't sure if they're needed for this feature, but let me know what you think of them and the expected behavior for if they're used. At the moment, this will raise an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally this looks good, but doesn't work when using just the add_to
/add_cc
/add_bcc
functions:
p = Personalization()
to_email = To('[email protected]', 'Example To Name 0')
p.add_to(to_email)
p.add_to(to_email)
Since there are several ways of setting/adding emails to these fields, and each set would result in a call to _get_unique_recipients
, why not just use that function once in each of the getters? For example:
@property
def tos(self):
return _get_unique_recipients(self._tos)
Going to get into updating this soon. Been extremely busy this last month, but going to make time for this when I can. Haven't forgotten this! |
…com:DougCal/sendgrid-python into remove_duplicate_emails_in_Personalizations
@eshanholtz ready for re-review! Loved the suggestion- cleaned up the code a lot. I tested making requests locally to be sure it prevented the duplicate email error and it worked quite well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for the contribution!
Fixes #788
This removes duplicate emails on setting the Personalization object, ignoring case.