#22455 closed Cleanup/optimization (fixed)
send_mail/send_messages do not document the return value
Reported by: | Mark Jones | Owned by: | mrezk |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Everything else is mentioned, but the return value for a successful message sent is never specified.
Normally you would assume True means success, except that sometimes 0 means success to that an error can be flagged with the remaining values.
You can find the answer in the source, but that makes it take a good deal longer. When talking about the backend and what it should implement, it seems like the return value should be specified.
Change History (12)
comment:1 by , 11 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 11 years ago
Has patch: | set |
---|
comment:4 by , 11 years ago
Patch needs improvement: | set |
---|
Hi,
The sentence you added is incorrect: send_messages
returns the number of emails sent (which is potentially 0).
comment:5 by , 11 years ago
Hi,
That is true, but I am actually documenting send_mail
. As far as I know, you can only send 0 or 1 emails with that method, is there a way to send more than 1 email with that method?
comment:6 by , 11 years ago
You're absolutely right (I got too far down the rabbit hole of figuring out what the return value was and forgot it was send_message
we were documenting).
Do we really need the "though generally ignored..." bit?
comment:7 by , 11 years ago
I thought that since I've never seen an example of send_mail
which takes in account the return value, it may be nice to clarify that the return value is generally ignored.
If you don't think that it may be misleading that none of the examples checks the return value, then it is OK for me to take it away =)
comment:9 by , 11 years ago
Pull request updated. Please feel free to make any subtle comments about style!
comment:10 by , 11 years ago
Pull request updated. Also included documentation for send_mass_mail return value
comment:11 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Pull request created: https://github.com/django/django/pull/2576
I found out that actually
send_messages
is documented on this section: https://docs.djangoproject.com/en/dev/topics/email/#defining-a-custom-email-backend, do you think we should add more information somewhere else?