#22407 closed Cleanup/optimization (fixed)

AdminEmailHandler should allow overriding the mail part of emit

Reported by: Keryn Knight <django@…> Owned by: nobody
Component: Utilities Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Imagine I want, for some subset of errors, to instead mail ... well, anyone but the ADMINS, at the moment, this is difficult because subclassing AdminEmailHandler to replace the mail.mail_admins part also means copying the entire emit method. It would be useful if a method could be used instead, like so:

class MyAdminEmailHandler(AdminEmailHandler):
    def send_mail(self, **kwargs):
        mail.mail_who_I_say(connection=self.connection(), **kwargs)

With the original implementation changing such that instead of emit() calling mail.mail_admins it instead calls self.send_mail(subject=subject, message=message, html_message=html_message)

Change History (4)

comment:1 Changed 18 months ago by timo

  • Component changed from Core (Mail) to Utilities
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 11 months ago by timgraham

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 11 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In d552da1f8d42b7c6db992fee42bc4781f5fdde43:

Fixed #22407 -- Added AdminEmailHandler.send_mail().

Note: See TracTickets for help on using tickets.
Back to Top