Example #1
0
def new_term_found(term, term_type, item_id, item_date):
    uuid_list = Term.get_term_uuid_list(term, 'regex')
    print('new tracked term found: {} in {}'.format(term, item_id))

    for term_uuid in uuid_list:
        Term.add_tracked_item(term_uuid, item_id, item_date)

        tags_to_add = Term.get_term_tags(term_uuid)
        for tag in tags_to_add:
            msg = '{};{}'.format(tag, item_id)
            p.populate_set_out(msg, 'Tags')

        mail_to_notify = Term.get_term_mails(term_uuid)
        if mail_to_notify:
            mail_subject = Tracker.get_email_subject(term_uuid)
            mail_body = mail_body_template.format(term, item_id, full_item_url, item_id)
        for mail in mail_to_notify:
            NotificationHelper.sendEmailNotification(mail, mail_subject, mail_body)
    def new_term_found(self, term, term_type, item_id, item_date):
        uuid_list = Term.get_term_uuid_list(term, term_type)
        self.redis_logger.info('new tracked term found: {} in {}'.format(
            term, item_id))

        for term_uuid in uuid_list:
            Term.add_tracked_item(term_uuid, item_id, item_date)

            tags_to_add = Term.get_term_tags(term_uuid)
            for tag in tags_to_add:
                msg = '{};{}'.format(tag, item_id)
                self.process.populate_set_out(msg, 'Tags')

            mail_to_notify = Term.get_term_mails(term_uuid)
            if mail_to_notify:
                mail_subject = Tracker.get_email_subject(term_uuid)
                mail_body = TermTrackerMod.mail_body_template.format(
                    term, item_id, self.full_item_url, item_id)
            for mail in mail_to_notify:
                self.redis_logger.debug('Send Mail {}'.format(mail_subject))
                NotificationHelper.sendEmailNotification(
                    mail, mail_subject, mail_body)