Beispiel #1
0
    def notify_recipients_of_job(self, job, status):
        """Notifies the recipients of a change in job status.

        Arguments:
            job {job} -- The job to notify the recipients of.
            status {str} -- The job status to notify the recipients.
            Only two values acceptable, both as constants:
                EmailUtil.OPENED
                EmailUtil.CLOSED
        """

        email_body = f'''
        {status}

        Title: {job.title}
        Dept.: {job.dept}
        Full Posting: {job.site_url}
        '''

        for recipient in Recipient.select():

            self.__create_message(job, email_body, recipient.email, status)

            self.__send_email(recipient.email)