This will automatically fix bugs such as one in which
internal_send_message didn't properly strip() the subject argument
before sending a message.
We change the recipient_type argument to internal_send_message to take
the recipient type name (e.g. 'stream') both to better fit the API and
also because the previous code incorrectly handled huddles.
(imported from commit 78c2596d328f6bb1ce2eaa3eed9a9e48146e3b6a)
Previously, AdminEmailHandler would crash if the record did not
contain any exception information (e.g. because it came from
logging.error()).
(imported from commit 868ec68f3a57eddbb2c851ecf9894e5eddf21e4c)
Previously when we logged errors using logging.error() but didn't
throw an exception, we would send these totally useless error
humbugs/emails that look like this:
Error generated by Anonymous user (not logged in)
No stack trace available
This change makes those messages include the actual text passed to
logging.error(), which is substantially more useful.
(imported from commit 76a8220ffe66d19cb0ca8ba9d1b42d5ecc4fd511)
If the database is down and the Handler crashes, we get an email with an
obnoxiously long subject line and without proper sanitization performed.
By wrapping internal_send_message in a try-except, we eliminate the most
common (read: to date, only) cause of crashes in our Handlers.
(imported from commit fd59e931ad0a4fff574d3cafa47348eacacb858f)
As a side-effect of customizing the e-mail, this also makes the host
on which the error happened a part of the subject line.
(imported from commit 7d5e9ad108b48fd34528512c5955567119935d4e)
For debugging in case this is ever different from platform.node(). I
think this would happen when using a CNAME, for example.
(imported from commit 47f6c3490712a3ac1c6a16f9146c2ef3ca8fc5e8)
We now encase the request info in a preformatted block, which ensures we
won't accidentally trigger any formatting while being reasonably
space-efficient.
(imported from commit 7c69a6ff2b2abd9474aae08b5ba608bcb40cec56)