Esempio n. 1
0
    def _format_subj(self, event):
        is_newticket = event.category == 'created'
        ticket = event.target

        summary = ticket['summary']
        if event.changes and 'summary' in event.changes['fields']:
            change = event.changes['fields']['summary']
            summary = "%s (was: %s)" % (change['new'], change['old'])

        prefix = self.config.get('notification', 'smtp_subject_prefix')
        if prefix == '__default__':
            prefix = '[%s]' % self.env.project_name

        data = {
            'prefix': prefix,
            'summary': summary,
            'ticket': ticket,
            'changes': event.changes,
            'env': self.env,
        }

        template = self.config.get('notification', 'ticket_subject_template')
        template = NewTextTemplate(template.encode('utf8'))
        subj = template.generate(**data).render('text', encoding=None).strip()
        if not is_newticket:
            subj = "Re: " + subj
        return subj
Esempio n. 2
0
    def format_subj(self, summary):
        template = self.config.get("notification", "ticket_subject_template")
        template = NewTextTemplate(template.encode("utf8"))

        prefix = self.config.get("notification", "smtp_subject_prefix")
        if prefix == "__default__":
            prefix = "[%s]" % self.env.project_name

        data = {"prefix": prefix, "summary": summary, "ticket": self.ticket, "env": self.env}

        return template.generate(**data).render("text", encoding=None).strip()
Esempio n. 3
0
    def format_subject(self):
        template = self.config.get('fullblog-notification', 'subject_template')
        template = NewTextTemplate(template.encode('utf8'))

        prefix = self.config.get('notification', 'smtp_subject_prefix')
        if prefix == '__default__':
            prefix = '[%s]' % self.config.get('project', 'name')

        action = self.action.strip('post_').replace('_', ' ')

        data = {'blog': self.blog, 'prefix': prefix, 'action': action}
        return template.generate(**data).render('text', encoding=None).strip()
Esempio n. 4
0
    def format_subj(self, tickets_descr):
        template = self.config.get('notification', 'batch_subject_template')
        template = NewTextTemplate(template.encode('utf8'))

        prefix = self.config.get('notification', 'smtp_subject_prefix')
        if prefix == '__default__':
            prefix = '[%s]' % self.env.project_name

        data = {
            'prefix': prefix,
            'tickets_descr': tickets_descr,
            'env': self.env,
        }
        subj = template.generate(**data).render('text', encoding=None).strip()
        return shorten_line(subj)
Esempio n. 5
0
 def format_subj(self, tickets_descr):
     template = self.config.get('notification','batch_subject_template')
     template = NewTextTemplate(template.encode('utf8'))
                                             
     prefix = self.config.get('notification', 'smtp_subject_prefix')
     if prefix == '__default__': 
         prefix = '[%s]' % self.env.project_name
     
     data = {
         'prefix': prefix,
         'tickets_descr': tickets_descr,
         'env': self.env,
     }
     
     return template.generate(**data).render('text', encoding=None).strip()
Esempio n. 6
0
    def format_subject(self, action):
        template = self.config.get('wiki-notification', 'subject_template')
        template = NewTextTemplate(template.encode('utf8'))

        prefix = self.config.get('notification', 'smtp_subject_prefix')
        if prefix == '__default__':
            prefix = '[%s]' % self.config.get('project', 'name')

        data = {
            'pagename': self.old_name or self.page.name,
            'prefix': prefix,
            'action': action,
            'env': self.env,
        }
        return template.generate(**data).render('text', encoding=None).strip()
    def format_subject(self, action):
        template = self.config.get('wiki-notification', 'subject_template')
        template = NewTextTemplate(template.encode('utf8'))

        prefix = self.config.get('notification', 'smtp_subject_prefix')
        if prefix == '__default__':
            prefix = '[%s]' % self.config.get('project', 'name')

        data = {
            'pagename': self.old_name or self.page.name,
            'prefix': prefix,
            'action': action,
            'env': self.env,
        }
        return template.generate(**data).render('text', encoding=None).strip()
Esempio n. 8
0
    def format_subj(self, summary):
        template = self.config.get('notification', 'ticket_subject_template')
        template = NewTextTemplate(template.encode('utf8'))

        prefix = self.config.get('notification', 'smtp_subject_prefix')
        if prefix == '__default__':
            prefix = '[%s]' % self.env.project_name

        data = {
            'prefix': prefix,
            'summary': summary,
            'ticket': self.ticket,
            'env': self.env,
        }

        return template.generate(**data).render('text', encoding=None).strip()
Esempio n. 9
0
    def format_subj(self, summary, newticket=True):
        template = self.config.get('notification', 'ticket_subject_template')
        template = NewTextTemplate(template.encode('utf8'))

        prefix = self.config.get('notification', 'smtp_subject_prefix')
        if prefix == '__default__':
            prefix = '[%s]' % self.env.project_name

        data = {
            'prefix': prefix,
            'summary': summary,
            'ticket': self.ticket,
            'env': self.env,
        }

        subj = template.generate(**data).render('text', encoding=None).strip()
        if not newticket:
            subj = "Re: " + subj
        return subj