MozillaFoundation / donate-wagtail

[Legacy] - Wagtail based donation stack
Mozilla Public License 2.0
43 stars 22 forks source link

Clean up "attemp_send_mail" function. #1655

Closed danielfmiranda closed 6 months ago

danielfmiranda commented 2 years ago

[Follow up issue to #1654]

In acoustic.py, we have a function named send_mail and attempt_send_mail , which both receive the arguments (to, campaign_id, fields, bcc, save_to_db).

Originally, only send_mail received these arguments and converted them to a singular XML object using the function transact_xml. Once converted, we then sent this object to the attempt_send_mail function, which used to recieve only the arguments (self, xml).

However in PR #1654 (where we implemented a try/except block to retry sending the email in case of a connection error), we had trouble getting the python scheduler to work with this singular XML object.

If we find a way to remove so many (to, campaign_id, fields, bcc, save_to_db) though and get the scheduler to work, I believe this might help make the code easier to read/understand/maintain.