#26210: When emailing the admins about exceptions and an error occurs, it
continues
as if there had been no error
-----------------------------+--------------------------------------
Reporter: aptiko | Owner: nobody
Type: Bug | Status: new
Component: Core (Mail) | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Comment (by aptiko):
It is intentional that the failure of the emailing be silent. However, the
proper way of achieving this is the following pseudocode:
{{{
try:
connect_to_the_mail_server();
say_ehlo();
start_tls();
say_ehlo();
login();
specify_mailfrom_rcptto_and_data();
close_connection_to_the_mail_server();
except:
pass;
}}}
Instead, what it now does is this:
{{{
try:
connect_to_the_mail_server();
say_ehlo();
start_tls();
say_ehlo();
login();
except:
pass;
try:
specify_mailfrom_rcptto_and_data();
except:
pass;
try:
close_connection_to_the_mail_server();
except:
pass;
}}}
(The first block is what `open()` does, the second is what
`send_messages()` does, and the third is what `close()` does; these are
methods in `django.core.mail.backend.smtp.EmailBackend`.)
Call me a perfectionist (with deadlines), but it's really ugly to proceed
with the second block if an error has occurred on the first block. I
haven't seen any really bad consequences (other than that it made it
harder for me to debug an unrelated problem I was having), but it's risky.
It's not hard to fix with a little restructuring of the code (unit testing
such restructuring is the hardest part), but I'm not volunteering to do
it, sorry :-)
--
Ticket URL: <https://code.djangoproject.com/ticket/26210#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.32ca5d4a9182742cba1d72cb6a4c2a85%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.