Allow just html_body and text_body for send_email #879

wants to merge 1 commit into

3 participants


A patch for i878 (#878)


In what case would to_addresses be optional?

That is a side-effect of the parameter ordering. I agree that it is undesirable. I'm willing to add a check somewhere in there and write proper unit tests to make sure they're always ensured, provided somebody told me how to write a test for the ses module as this module seems to be missing any tests at all.

keyword args are optional in Python, this breaks down the moment you require an optional keyword arg. I'd suggest thinking of another approach for this.

Could you clarify? I don't see a breakage as far as 'to_addresses' is present in the arguments. I could add a check to make sure it is non-empty and raise some helpful exception on the contrary case. The 'body' CAN be empty, as far as text_body or html_body or both of those are present.

A keyword arg (such as to_address and body in your modified version) infers that it is optional. A positional argument, or a parameter, is required (source, subject). Adding a check to make sure an optional keyword arg is specified violates the whole point of an optional keyword arg. That is exactly what a positional/parameter is for.

So the bad thing about changing body and to_address to be optional kwargs is that our users will see that these are optional, and wonder what on earth is up. When you would ever want to use send_email with an empty to_address (no recipient?) or empty body (no content?).

I hear you.

@garnaat garnaat closed this Feb 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment