示例#1
0
    def notify_email(self, template, subject, perm_setting='editor_reviewed'):
        """Notify the authors that their addon has been reviewed."""
        data = self.data.copy() if self.data else {}
        data.update(self.get_context_data())
        data['tested'] = ''
        os, app = data.get('operating_systems'), data.get('applications')
        if os and app:
            data['tested'] = 'Tested on %s with %s' % (os, app)
        elif os and not app:
            data['tested'] = 'Tested on %s' % os
        elif not os and app:
            data['tested'] = 'Tested with %s' % app
        subject = subject % (data['name'],
                             self.version.version if self.version else '')

        message = loader.get_template('editors/emails/%s.ltxt' %
                                      template).render(
                                          Context(data, autoescape=False))
        if not waffle.switch_is_active('activity-email'):
            emails = [a.email for a in self.addon.authors.all()]
            amo_send_mail(subject,
                          message,
                          recipient_list=emails,
                          from_email=settings.EDITORS_EMAIL,
                          use_deny_list=False,
                          perm_setting=perm_setting)
        else:
            send_activity_mail(subject, message, self.version,
                               self.addon.authors.all(),
                               settings.EDITORS_EMAIL, perm_setting)
示例#2
0
    def notify_email(self, template, subject, perm_setting='editor_reviewed'):
        """Notify the authors that their addon has been reviewed."""
        data = self.data.copy() if self.data else {}
        data.update(self.get_context_data())
        data['tested'] = ''
        os, app = data.get('operating_systems'), data.get('applications')
        if os and app:
            data['tested'] = 'Tested on %s with %s' % (os, app)
        elif os and not app:
            data['tested'] = 'Tested on %s' % os
        elif not os and app:
            data['tested'] = 'Tested with %s' % app
        subject = subject % (data['name'],
                             self.version.version if self.version else '')

        message = loader.get_template(
            'editors/emails/%s.ltxt' % template).render(
            Context(data, autoescape=False))
        if not waffle.switch_is_active('activity-email'):
            emails = [a.email for a in self.addon.authors.all()]
            amo_send_mail(
                subject, message, recipient_list=emails,
                from_email=settings.EDITORS_EMAIL, use_deny_list=False,
                perm_setting=perm_setting)
        else:
            send_activity_mail(
                subject, message, self.version, self.addon.authors.all(),
                settings.EDITORS_EMAIL, perm_setting)
示例#3
0
def send_mail(template, subject, emails, context, perm_setting=None):
    template = loader.get_template(template)
    amo_send_mail(subject,
                  template.render(Context(context, autoescape=False)),
                  recipient_list=emails,
                  from_email=settings.EDITORS_EMAIL,
                  use_blacklist=False,
                  perm_setting=perm_setting)
示例#4
0
 def send_super_mail(self):
     self.log_action(amo.LOG.REQUEST_SUPER_REVIEW)
     log.info(u'Super review requested for %s' % (self.addon))
     data = self.get_context_data()
     message = (loader
                .get_template('editors/emails/super_review.ltxt')
                .render(Context(data, autoescape=False)))
     amo_send_mail(u'Super review requested: %s' % (data['name']), message,
                   recipient_list=[settings.SENIOR_EDITORS_EMAIL],
                   from_email=settings.EDITORS_EMAIL,
                   use_deny_list=False)
示例#5
0
 def send_super_mail(self):
     self.log_action(amo.LOG.REQUEST_SUPER_REVIEW)
     log.info(u'Super review requested for %s' % (self.addon))
     data = self.get_context_data()
     message = (loader
                .get_template('editors/emails/super_review.ltxt')
                .render(Context(data, autoescape=False)))
     amo_send_mail(u'Super review requested: %s' % (data['name']), message,
                   recipient_list=[settings.SENIOR_EDITORS_EMAIL],
                   from_email=settings.EDITORS_EMAIL,
                   use_deny_list=False)
示例#6
0
def send_mail(template, subject, emails, context, perm_setting=None):
    template = loader.get_template(template)
    amo_send_mail(subject, template.render(Context(context, autoescape=False)),
                  recipient_list=emails, from_email=settings.EDITORS_EMAIL,
                  use_blacklist=False, perm_setting=perm_setting)
示例#7
0
def send_mail(template, subject, emails, context, perm_setting):
    template = loader.get_template(template)
    amo_send_mail(
        subject, template.render(Context(context, autoescape=False)),
        recipient_list=emails, perm_setting=perm_setting)
示例#8
0
def send_mail(template, subject, emails, context, perm_setting):
    template = loader.get_template(template)
    amo_send_mail(subject,
                  template.render(Context(context, autoescape=False)),
                  recipient_list=emails,
                  perm_setting=perm_setting)