コード例 #1
0
class EmailNotificator(Notificator):
    def apply(self, abstract, tpl):
        vars = self._getVars(abstract)
        subj = tpl.getTplSubject() % vars
        try:
            b = tpl.getTplBody() % vars
        except ValueError, e:
            raise MaKaCError(
                _("Some of the mail notification template's tags are invalid. Note that the format of the tags should be: %(tag_name)s"
                  ))
        fa = tpl.getFromAddr()
        cc = tpl.getCCAddrList()
        # Add Co-authors addresses if needed
        if tpl.getCAasCCAddr():
            ccList = cc + abstract.getCoAuthorEmailList()
        else:
            ccList = cc

        tl = []
        for user in tpl.getToAddrs(abstract):
            if not user.getEmail() in tl:
                tl.append(user.getEmail())
        return Notification(subject=subj,
                            body=b,
                            fromAddr=fa,
                            toList=tl,
                            ccList=ccList)
コード例 #2
0
 def apply(self,registrant,params):
     v=self._getVars(registrant)
     subj=params.get("subject","").format(**v)
     b=params.get("body","").format(**v)
     fa=params.get("from","")
     tl=params.get("to",[])
     cc = params.get("cc",[])
     return Notification(subject=subj,body=b,fromAddr=fa,toList=tl,ccList=cc)
コード例 #3
0
 def notifyAll(self,params):
     subj=params.get("subject","")
     b=params.get("body","")
     fa=params.get("from","")
     tl=params.get("to",[])
     cc = params.get("cc",[])
     notification =  Notification(subject=subj,body=b,fromAddr=fa,toList=tl,ccList=cc)
     if params.has_key("conf"):
         GenericMailer.sendAndLog(notification, params["conf"],
                                  log.ModuleNames.REGISTRATION)
     else:
         GenericMailer.send(notification)