This PR attempts to simplify dict_to_email by removing and saving the items from messagedict in one loop (based on a list items that will be message attributes). I did something similar with setting the attributes on the message object too. I also tried to improve some of the variable names (ret -> message, etc) and add some comments.
This also removes some dead code:
no need to "bring back mixed subtype for 'retry'" since it's using deepcopy now
the if hasattr(messagedict, 'from_email'): part doesn't seem necessary anymore since send_emails ensures messagedict is a dictionary, also there's some code above that wouldn't work on non-dictionaries anyway
This PR attempts to simplify
dict_to_email
by removing and saving the items frommessagedict
in one loop (based on a list items that will be message attributes). I did something similar with setting the attributes on the message object too. I also tried to improve some of the variable names (ret
->message
, etc) and add some comments.This also removes some dead code:
if hasattr(messagedict, 'from_email'):
part doesn't seem necessary anymore sincesend_emails
ensuresmessagedict
is a dictionary, also there's some code above that wouldn't work on non-dictionaries anyway