Esempio n. 1
27
    def run(self):
        self._prepare()
        self._logger.info('Running task {}.. (delay: {})'.format(self._task.id, self._executionDelay))

        try:
            for i, retry in enumerate(transaction.attempts(self._config.task_max_tries)):
                with retry:
                    self._logger.info('Task attempt #{}'.format(i))
                    if i > 0:
                        self._prepare_retry()
                    try:
                        self._process_task()
                        break
                    except ConflictError:
                        transaction.abort()
                    except ClientDisconnected:
                        self._logger.warning("Retrying for the {}th time in {} secs..".format(i + 1, seconds))
                        transaction.abort()
                        time.sleep(i * 10)
                    except TaskDelayed, e:
                        self._logger.info("{} delayed by {} seconds".format(self._task, e.delaySeconds))
                        self._delayed = True
                        self._executionDelay = 0
                        time.sleep(e.delaySeconds)
            flush_after_commit_queue(True)
            GenericMailer.flushQueue(True)
Esempio n. 2
0
    def _getAnswer(self):
        report = ""
        i = 0
        for email in self.emailToList:
            i += 1
            if i != len(self.emailToList):
                report += "%s, " % email
            else:
                report += "%s." % email

        # {url} and {talkTitle} are mandatory to send the EA link
        if self.content.find("{url}") == -1:
            report = "url_error"
        elif self.content.find("{talkTitle}") == -1:
            report = "talkTitle_error"
        else:
            manager = self._conf.getCSBookingManager()
            for uniqueId in self.uniqueIdList:
                sw = manager.getSpeakerWrapperByUniqueId(uniqueId)
                sw.setStatus(SpeakerStatusEnum.PENDING)
                subject = """[Indico] Electronic Agreement: %s (event id: %s)""" % (
                    self._conf.getTitle(),
                    self._conf.getId(),
                )
                notification = ElectroniAgreementNotification(
                    [sw.getObject().getEmail()], self.fromEmail, self.processContent(sw), subject
                )

                GenericMailer.sendAndLog(
                    notification, self._conf, "MaKaC/plugins/Collaboration/RecordingRequest/collaboration.py", None
                )
        return report
Esempio n. 3
0
    def _sendMail(self, operation):
        """
        Overloads _sendMail behavior for EVO
        """

        if operation == 'new':
            #notification to admin
            try:
                notification = notifications.NewVidyoPublicRoomNotificationAdmin(self)
                GenericMailer.sendAndLog(notification, self.getConference(),
                                         self.getPlugin().getName())
            except Exception, e:
                Logger.get('Vidyo').error(
                    """Could not send NewVidyoPublicRoomNotificationAdmin for booking with id %s of event with id %s, exception: %s""" %
                    (self.getId(), self.getConference().getId(), str(e)))

            #notification to owner
            if isinstance(self.getOwnerObject(), Avatar):
                try:
                    notification = notifications.VidyoOwnerChosenNotification(self)
                    GenericMailer.sendAndLog(notification, self.getConference(),
                                             self.getPlugin().getName())

                except Exception, e:
                    Logger.get('Vidyo').error(
                        """Could not send VidyoOwnerChosenNotification for booking with id %s of event with id %s, exception: %s""" %
                        (self.getId(), self.getConference().getId(), str(e)))
Esempio n. 4
0
    def invokeMethod(self, method, params, req):

        MAX_RETRIES = 10

        # clear the context
        ContextManager.destroy()

        DBMgr.getInstance().startRequest()

        # room booking database
        _startRequestSpecific2RH()

        # notify components that the request has started
        self._notify('requestStarted', req)

        forcedConflicts = Config.getInstance().getForceConflicts()
        retry = MAX_RETRIES
        try:
            while retry > 0:
                if retry < MAX_RETRIES:
                    # notify components that the request is being retried
                    self._notify('requestRetry', req, MAX_RETRIES - retry)

                try:
                    # delete all queued emails
                    GenericMailer.flushQueue(False)

                    DBMgr.getInstance().sync()

                    try:
                        result = processRequest(method, copy.deepcopy(params), req)
                    except MaKaC.errors.NoReportError, e:
                        raise NoReportError(e.getMsg())
                    rh = ContextManager.get('currentRH')

                    # notify components that the request has ended
                    self._notify('requestFinished', req)
                    # Raise a conflict error if enabled. This allows detecting conflict-related issues easily.
                    if retry > (MAX_RETRIES - forcedConflicts):
                        raise ConflictError
                    _endRequestSpecific2RH( True )
                    DBMgr.getInstance().endRequest(True)
                    GenericMailer.flushQueue(True) # send emails
                    if rh._redisPipeline:
                        try:
                            rh._redisPipeline.execute()
                        except RedisError:
                            Logger.get('redis').exception('Could not execute pipeline')
                    break
                except ConflictError:
                    _abortSpecific2RH()
                    DBMgr.getInstance().abort()
                    retry -= 1
                    continue
                except ClientDisconnected:
                    _abortSpecific2RH()
                    DBMgr.getInstance().abort()
                    retry -= 1
                    time.sleep(MAX_RETRIES - retry)
                    continue
Esempio n. 5
0
    def _getAnswer(self):
        report = ""
        i = 0
        for email in self.emailToList:
            i += 1
            if i != len(self.emailToList):
                report += "%s, " % email
            else:
                report += "%s." % email

        #{url} and {talkTitle} are mandatory to send the EA link
        if self.content.find('{url}') == -1:
            report = "url_error"
        elif self.content.find('{talkTitle}') == -1:
            report = "talkTitle_error"
        else:
            manager = self._conf.getCSBookingManager()
            for uniqueId in self.uniqueIdList:
                sw = manager.getSpeakerWrapperByUniqueId(uniqueId)
                if sw.getStatus() not in [
                        SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE
                ]:
                    sw.setStatus(SpeakerStatusEnum.PENDING)
                    subject = """[Indico] Electronic Agreement: '%s'""" % (
                        self._conf.getTitle())
                    notification = ElectronicAgreementNotification(
                        [sw.getObject().getEmail()], self.cc, self.fromEmail,
                        self.fromName, self.processContent(sw), subject)

                    GenericMailer.sendAndLog(
                        notification, self._conf,
                        "MaKaC/plugins/Collaboration/RecordingRequest/collaboration.py",
                        None)
        return report
Esempio n. 6
0
    def _sendMail(self, operation):
        """
        Overloads _sendMail behavior for EVO
        """

        if operation == 'new':
            #notification to admin
            try:
                notification = notifications.NewVidyoPublicRoomNotificationAdmin(
                    self)
                GenericMailer.sendAndLog(
                    notification, self.getConference(),
                    "MaKaC/plugins/Collaboration/Vidyo/collaboration.py",
                    self.getConference().getCreator())
            except Exception, e:
                Logger.get('Vidyo').error(
                    """Could not send NewVidyoPublicRoomNotificationAdmin for booking with id %s of event with id %s, exception: %s"""
                    % (self.getId(), self.getConference().getId(), str(e)))

            #notification to owner
            if isinstance(self.getOwnerObject(), Avatar):
                try:
                    notification = notifications.VidyoOwnerChosenNotification(
                        self)
                    GenericMailer.sendAndLog(
                        notification, self.getConference(),
                        "MaKaC/plugins/Collaboration/Vidyo/collaboration.py",
                        self.getConference().getCreator())

                except Exception, e:
                    Logger.get('Vidyo').error(
                        """Could not send VidyoOwnerChosenNotification for booking with id %s of event with id %s, exception: %s"""
                        % (self.getId(), self.getConference().getId(), str(e)))
Esempio n. 7
0
    def alertCreation(self, confs):
        conf = confs[0]
        fromAddr = Config.getInstance().getSupportEmail()
        addrs = [ Config.getInstance().getSupportEmail() ]
        eventType = conf.getType()
        if eventType == "conference":
            type = "conference"
        elif eventType == "meeting":
            type = "meeting"
        else:
            type = "lecture"
        chair = ""
        if conf.getChairmanText() != "":
            chair = conf.getChairmanText()
        else:
            for c in conf.getChairList():
                chair += c.getFullName() + "; "
        subject = "New %s in indico (%s)" % (type,conf.getId())
        if conf.getRoom() != None:
            room = conf.getRoom().getName()
        else:
            room = ""
        text = """
_Category_
%s
_Title_
%s
_Speaker/Chair_
%s
_Room_
%s
_Description_
%s
_Creator_
%s (%s)"""%(conf.getOwner().getTitle(), conf.getTitle(), chair, room, conf.getDescription(), conf.getCreator().getFullName(), conf.getCreator().getId())
        if len(confs) == 1:
            text += """
_Date_
%s -> %s
_Access_
%s""" % ( conf.getAdjustedStartDate(), conf.getAdjustedEndDate(), urlHandlers.UHConferenceDisplay.getURL(conf))
        else:
            i = 1
            for c in confs:
                text += """
_Date%s_
%s -> %s
_Access%s_
%s """ % (i,c.getAdjustedStartDate(), c.getAdjustedEndDate(), i,urlHandlers.UHConferenceDisplay.getURL(c))
                i+=1

        msg = ("Content-Type: text/plain; charset=\"utf-8\"\r\nFrom: %s\r\nReturn-Path: %s\r\nTo: %s\r\nCc: \r\nSubject: %s\r\n\r\n"%(fromAddr, fromAddr, addrs, subject))
        msg = msg + text
        maildata = { "fromAddr": fromAddr, "toList": addrs, "subject": subject, "body": text }
        GenericMailer.send(maildata)
        # Category notification
        if conf.getOwner().getNotifyCreationList() != "":
            addrs2 = [ conf.getOwner().getNotifyCreationList() ]
            maildata2 = { "fromAddr": fromAddr, "toList": addrs2, "subject": subject, "body": text }
            GenericMailer.send(maildata2)
Esempio n. 8
0
    def run(self):
        self._prepare()
        self._logger.info('Running task {}.. (delay: {})'.format(self._task.id, self._executionDelay))

        try:
            for i, retry in enumerate(transaction.attempts(self._config.task_max_tries)):
                with retry:
                    self._logger.info('Task attempt #{}'.format(i))
                    if i > 0:
                        self._prepare_retry()
                    try:
                        self._process_task()
                        break
                    except ConflictError:
                        transaction.abort()
                    except ClientDisconnected:
                        self._logger.warning("Retrying for the {}th time in {} secs..".format(i + 1, seconds))
                        transaction.abort()
                        time.sleep(i * 10)
                    except TaskDelayed, e:
                        self._logger.info("{} delayed by {} seconds".format(self._task, e.delaySeconds))
                        self._delayed = True
                        self._executionDelay = 0
                        time.sleep(e.delaySeconds)
            flush_after_commit_queue(True)
            GenericMailer.flushQueue(True)
Esempio n. 9
0
 def removePaperReviewManager(self, paperReviewManager):
     """ Remove a paper review manager from the conference.
         paperReviewManager has to be an Avatar object.
         The paper review manager is sent a mail notification.
     """
     if paperReviewManager in self._paperReviewManagersList:
         if self._userCompetences.has_key(paperReviewManager):
             if not ((paperReviewManager in self._editorsList) or \
                     (paperReviewManager in self._reviewersList) or \
                     (paperReviewManager in self._refereesList)):
                 self.clearUserCompetences(paperReviewManager)
                 del (self._userCompetences[paperReviewManager])
         self._paperReviewManagersList.remove(paperReviewManager)
         paperReviewManager.unlinkTo(self._conference, "paperReviewManager")
         self.notifyModification()
         if self._enablePRMEmailNotif == True:
             notification = ConferenceReviewingRemoveNotification(
                 paperReviewManager, 'Paper Review Manager',
                 self._conference)
             GenericMailer.sendAndLog(notification, self._conference,
                                      'Paper Reviewing')
     else:
         raise MaKaCError(
             "Cannot remove a paper review manager who is not yet paper review manager"
         )
Esempio n. 10
0
    def alertCreation(self, confs):
        conf = confs[0]
        fromAddr = Config.getInstance().getSupportEmail()
        addrs = [ Config.getInstance().getSupportEmail() ]
        eventType = conf.getType()
        if eventType == "conference":
            type = "conference"
        elif eventType == "meeting":
            type = "meeting"
        else:
            type = "lecture"
        chair = ""
        if conf.getChairmanText() != "":
            chair = conf.getChairmanText()
        else:
            for c in conf.getChairList():
                chair += c.getFullName() + "; "
        subject = "New %s in indico (%s)" % (type,conf.getId())
        if conf.getRoom() != None:
            room = conf.getRoom().getName()
        else:
            room = ""
        text = """
_Category_
%s
_Title_
%s
_Speaker/Chair_
%s
_Room_
%s
_Description_
%s
_Creator_
%s (%s)"""%(conf.getOwner().getTitle(), conf.getTitle(), chair, room, conf.getDescription(), conf.getCreator().getFullName(), conf.getCreator().getId())
        if len(confs) == 1:
            text += """
_Date_
%s -> %s
_Access_
%s""" % ( conf.getAdjustedStartDate(), conf.getAdjustedEndDate(), urlHandlers.UHConferenceDisplay.getURL(conf))
        else:
            i = 1
            for c in confs:
                text += """
_Date%s_
%s -> %s
_Access%s_
%s """ % (i,c.getAdjustedStartDate(), c.getAdjustedEndDate(), i,urlHandlers.UHConferenceDisplay.getURL(c))
                i+=1

        msg = ("Content-Type: text/plain; charset=\"utf-8\"\r\nFrom: %s\r\nReturn-Path: %s\r\nTo: %s\r\nCc: \r\nSubject: %s\r\n\r\n"%(fromAddr, fromAddr, addrs, subject))
        msg = msg + text
        maildata = { "fromAddr": fromAddr, "toList": addrs, "subject": subject, "body": text }
        GenericMailer.send(maildata)
        # Category notification
        if conf.getOwner().getNotifyCreationList() != "":
            addrs2 = [ conf.getOwner().getNotifyCreationList() ]
            maildata2 = { "fromAddr": fromAddr, "toList": addrs2, "subject": subject, "body": text }
            GenericMailer.send(maildata2)
Esempio n. 11
0
 def _send_confirmation(self, email):
     token_storage = GenericCache('confirm-email')
     data = {'email': email, 'user_id': self.user.id}
     token = make_unique_token(lambda t: not token_storage.get(t))
     token_storage.set(token, data, 24 * 3600)
     GenericMailer.send(make_email(email, template=get_template_module('users/emails/verify_email.txt',
                                                                       user=self.user, email=email, token=token)))
Esempio n. 12
0
    def _getAnswer(self):
        report = ", ".join(self.emailToList) + "."

        # {url} and {talkTitle} are mandatory to send the EA link
        if self.content.find("{url}") == -1:
            report = "url_error"
        elif self.content.find("{talkTitle}") == -1:
            report = "talkTitle_error"
        else:
            manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
            for uniqueId in self.uniqueIdList:
                sw = manager.getSpeakerWrapperByUniqueId(uniqueId)
                if sw.getStatus() not in [SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE]:
                    sw.setStatus(SpeakerStatusEnum.PENDING)
                    subject = """[Indico] Electronic Agreement: '%s'""" % (self._conf.getTitle())
                    notification = ElectronicAgreementNotification(
                        [sw.getObject().getEmail()],
                        self.cc,
                        self.fromEmail,
                        self.fromName,
                        self.processContent(sw),
                        subject,
                    )

                    GenericMailer.sendAndLog(notification, self._conf, MODULE_NAME)
        return report
Esempio n. 13
0
    def _getAnswer(self):
        spkWrapper = None
        manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
        for sw in manager.getSpeakerWrapperList():
            if sw.getUniqueIdHash() == self.authKey:
                spkWrapper = sw

        if spkWrapper:
            spkWrapper.setStatus(SpeakerStatusEnum.REFUSED)
            spkWrapper.setRejectReason(self.reason)
            spkWrapper.triggerNotification()
            if manager.notifyElectronicAgreementAnswer():
                subject = """[Indico] Electronic Agreement Rejected: '%s'""" % (self._conf.getTitle())
                content = _(self.MESSAGE_REJECT).format(
                    speaker=spkWrapper.getObject().getDirectFullName(),
                    title=self._conf.getTitle(),
                    reason=self.reason,
                    url=self._conf.getURL())
                emailToList = [self._conf.getCreator().getEmail()]
                for event_manager in self._conf.getManagerList():
                    emailToList.append(event_manager.getEmail())
                notification = ElectronicAgreementOrganiserNotification(emailToList, Config.getInstance().getNoReplyEmail(), content, subject)

                GenericMailer.sendAndLog(notification, self._conf,
                                         MODULE_NAME)
Esempio n. 14
0
    def _getAnswer(self):
        report = ""
        i = 0
        for email in self.emailToList:
            i += 1
            if i != len(self.emailToList):
                report += "%s, "%email
            else:
                report += "%s."%email

        #{url} and {talkTitle} are mandatory to send the EA link
        if self.content.find('{url}') == -1:
            report = "url_error"
        elif self.content.find('{talkTitle}') == -1:
            report = "talkTitle_error"
        else:
            manager = self._conf.getCSBookingManager()
            for uniqueId in self.uniqueIdList:
                sw = manager.getSpeakerWrapperByUniqueId(uniqueId)
                if sw.getStatus() not in [SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE]:
                    sw.setStatus(SpeakerStatusEnum.PENDING)
                    subject = """[Indico] Electronic Agreement: '%s'"""%(self._conf.getTitle())
                    notification = ElectronicAgreementNotification([sw.getObject().getEmail()], self.cc, self.fromEmail, self.fromName, self.processContent(sw), subject)

                    GenericMailer.sendAndLog(notification, self._conf,
                                             MODULE_NAME)
        return report
Esempio n. 15
0
    def sendNotificationEmail(self, withdrawn = False):
        """ Sends an email to the contribution's submitters when the referee, editor or reviewer
            pass a judgement on the contribution and only if the manager has enabled the option in 'Automatic e-mails' section.
        """
        review_manager = self.getReviewManager()
        authorList = review_manager.contribution.submitters
        referee = self.getReviewManager().getReferee()
        for author in authorList:
            if (isinstance(self, RefereeJudgement) and self.getConfPaperReview().getEnableRefereeJudgementEmailNotif()) \
            or (isinstance(self, EditorJudgement) and (self._review.getConference().getConfPaperReview().getChoice() == ConferencePaperReview.LAYOUT_REVIEWING or not self.getJudgement() in ["Accept", "Reject"]) and self.getConfPaperReview().getEnableEditorJudgementEmailNotif()) \
            or (isinstance(self, ReviewerJudgement) and not self.getJudgement() in ["Accept", "Reject"] and self.getConfPaperReview().getEnableReviewerJudgementEmailNotif()):
                if withdrawn:
                    notification = ContributionReviewingJudgementWithdrawalNotification(author, self, self.getReviewManager().contribution)
                else:
                    notification = ContributionReviewingJudgementNotification(author, self, self.getReviewManager().contribution)
                GenericMailer.sendAndLog(notification,
                                         self._review.getConference(),
                                         'Paper Reviewing')

        # We send an email to the Referee if the layout or the content reviewer has sent a judgement

        if (self.getConfPaperReview().getChoice() == 4 and isinstance(self, EditorJudgement) \
        and self.getConfPaperReview().getEnableEditorSubmittedRefereeEmailNotif()) \
        or ((self.getConfPaperReview().getChoice() == 2 or self.getConfPaperReview().getChoice() == 4) and isinstance(self, ReviewerJudgement) \
        and self.getConfPaperReview().getEnableReviewerSubmittedRefereeEmailNotif()):
            if withdrawn:
                notification = ContributionReviewingJudgementRefereeWithdrawalNotification(referee, self, self.getReviewManager().contribution)
            else:
                notification = ContributionReviewingJudgementRefereeNotification(referee, self, self.getReviewManager().contribution)
            GenericMailer.sendAndLog(notification,
                                     self._review.getConference(),
                                     'Paper Reviewing')
Esempio n. 16
0
    def _getAnswer(self):
        spkWrapper = None
        manager = Catalog.getIdx("cs_bookingmanager_conference").get(
            self._conf.getId())
        for sw in manager.getSpeakerWrapperList():
            if sw.getUniqueIdHash() == self.authKey:
                spkWrapper = sw

        if spkWrapper:
            spkWrapper.setStatus(SpeakerStatusEnum.SIGNED, request.remote_addr)
            spkWrapper.triggerNotification()
            if manager.notifyElectronicAgreementAnswer():
                subject = """[Indico] Electronic Agreement Accepted: '%s'""" % (
                    self._conf.getTitle())
                content = _(self.MESSAGE_ACCEPT).format(
                    speaker=spkWrapper.getObject().getDirectFullName(),
                    title=self._conf.getTitle(),
                    url=self._conf.getURL())
                emailToList = [self._conf.getCreator().getEmail()]
                for event_manager in self._conf.getManagerList():
                    emailToList.append(event_manager.getEmail())
                notification = ElectronicAgreementOrganiserNotification(
                    emailToList,
                    Config.getInstance().getNoReplyEmail(), content, subject)

                GenericMailer.sendAndLog(notification, self._conf, MODULE_NAME)
Esempio n. 17
0
    def _getAnswer(self):
        spkWrapper = None
        manager = self._conf.getCSBookingManager()
        for sw in manager.getSpeakerWrapperList():
            if sw.getUniqueIdHash() == self.authKey:
                spkWrapper = sw

        if spkWrapper:
            spkWrapper.setStatus(SpeakerStatusEnum.SIGNED,
                                 self._req.get_remote_ip())
            spkWrapper.triggerNotification()
            if manager.notifyElectronicAgreementAnswer():
                subject = """[Indico] Electronic Agreement Accepted: '%s'""" % (
                    self._conf.getTitle())
                content = _(self.MESSAGE_ACCEPT).format(
                    speaker=spkWrapper.getObject().getDirectFullName(),
                    title=self._conf.getTitle(),
                    url=self._conf.getURL())
                emailToList = [self._conf.getCreator().getEmail()]
                for event_manager in self._conf.getManagerList():
                    emailToList.append(event_manager.getEmail())
                notification = ElectronicAgreementOrganiserNotification(
                    emailToList,
                    Config.getInstance().getNoReplyEmail(), content, subject)

                GenericMailer.sendAndLog(
                    notification, self._conf,
                    "MaKaC/plugins/Collaboration/RecordingRequest/collaboration.py",
                    None)
Esempio n. 18
0
    def _getAnswer(self):
        report = ', '.join(self.emailToList) + '.'

        #{url} and {talkTitle} are mandatory to send the EA link
        if self.content.find('{url}') == -1:
            report = "url_error"
        elif self.content.find('{talkTitle}') == -1:
            report = "talkTitle_error"
        else:
            manager = Catalog.getIdx("cs_bookingmanager_conference").get(
                self._conf.getId())
            for uniqueId in self.uniqueIdList:
                sw = manager.getSpeakerWrapperByUniqueId(uniqueId)
                if sw.getStatus() not in [
                        SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE
                ]:
                    sw.setStatus(SpeakerStatusEnum.PENDING)
                    subject = """[Indico] Electronic Agreement: '%s'""" % (
                        self._conf.getTitle())
                    notification = ElectronicAgreementNotification(
                        [sw.getObject().getEmail()], self.cc, self.fromEmail,
                        self.fromName, self.processContent(sw), subject)

                    GenericMailer.sendAndLog(notification, self._conf,
                                             MODULE_NAME)
        return report
Esempio n. 19
0
    def _getAnswer(self):
        spkWrapper = None
        manager = self._conf.getCSBookingManager()
        for sw in manager.getSpeakerWrapperList():
            if sw.getUniqueIdHash() == self.authKey:
                spkWrapper = sw

        if spkWrapper:
            spkWrapper.setStatus(SpeakerStatusEnum.REFUSED)
            spkWrapper.setRejectReason(self.reason)
            spkWrapper.triggerNotification()
            if manager.notifyElectronicAgreementAnswer():
                subject = """[Indico] Electronic Agreement Rejected: '%s'""" % (
                    self._conf.getTitle())
                content = _(self.MESSAGE_REJECT).format(
                    speaker=spkWrapper.getObject().getDirectFullName(),
                    title=self._conf.getTitle(),
                    reason=self.reason,
                    url=self._conf.getURL())
                emailToList = [self._conf.getCreator().getEmail()]
                for event_manager in self._conf.getManagerList():
                    emailToList.append(event_manager.getEmail())
                notification = ElectronicAgreementOrganiserNotification(
                    emailToList,
                    Config.getInstance().getNoReplyEmail(), content, subject)

                GenericMailer.sendAndLog(notification, self._conf, MODULE_NAME)
Esempio n. 20
0
    def sendNotificationEmail(self, withdrawn = False):
        """ Sends an email to the contribution's submitters when the referee, editor or reviewer
            pass a judgement on the contribution and only if the manager has enabled the option in 'Automatic e-mails' section.
        """
        review_manager = self.getReviewManager()
        authorList = review_manager.contribution.submitters
        referee = self.getReviewManager().getReferee()
        for author in authorList:
            if (isinstance(self, RefereeJudgement) and self.getConfPaperReview().getEnableRefereeJudgementEmailNotif()) \
            or (isinstance(self, EditorJudgement) and (self._review.getConference().getConfPaperReview().getChoice() == ConferencePaperReview.LAYOUT_REVIEWING or not self.getJudgement() in ["Accept", "Reject"]) and self.getConfPaperReview().getEnableEditorJudgementEmailNotif()) \
            or (isinstance(self, ReviewerJudgement) and not self.getJudgement() in ["Accept", "Reject"] and self.getConfPaperReview().getEnableReviewerJudgementEmailNotif()):
                if withdrawn:
                    notification = ContributionReviewingJudgementWithdrawalNotification(author, self, self.getReviewManager().contribution)
                else:
                    notification = ContributionReviewingJudgementNotification(author, self, self.getReviewManager().contribution)
                GenericMailer.sendAndLog(notification,
                                         self._review.getConference(),
                                         'Paper Reviewing')

        # We send an email to the Referee if the layout or the content reviewer has sent a judgement

        if (self.getConfPaperReview().getChoice() == 4 and isinstance(self, EditorJudgement) \
        and self.getConfPaperReview().getEnableEditorSubmittedRefereeEmailNotif()) \
        or ((self.getConfPaperReview().getChoice() == 2 or self.getConfPaperReview().getChoice() == 4) and isinstance(self, ReviewerJudgement) \
        and self.getConfPaperReview().getEnableReviewerSubmittedRefereeEmailNotif()):
            if withdrawn:
                notification = ContributionReviewingJudgementRefereeWithdrawalNotification(referee, self, self.getReviewManager().contribution)
            else:
                notification = ContributionReviewingJudgementRefereeNotification(referee, self, self.getReviewManager().contribution)
            GenericMailer.sendAndLog(notification,
                                     self._review.getConference(),
                                     'Paper Reviewing')
Esempio n. 21
0
    def send(self):
        url = urlHandlers.UHConfActiveAccount.getURL(
            self._conf) if self._conf else urlHandlers.UHActiveAccount.getURL(
            )
        text =  _("""Welcome to Indico,
You have created a new account on the Indico conference management system.

In order to activate your new account and being able to be authenticated by the system, please open on your web browser the following URL:

%s?userId=%s&key=%s

Once you've done it, your account will be fully operational so you can log in and start using the system normally.

Thank you for using our system.
                """)%(url,
                        self._user.getId(), \
                        self._user.getKey())
        maildata = {
            "fromAddr":
            "Indico Mailer <%s>" % Config.getInstance().getNoReplyEmail(),
            "toList": [self._user.getEmail()],
            "subject":
            _("[%s] Confirmation request") % getSubjectIndicoTitle(),
            "body":
            text
        }
        GenericMailer.send(GenericNotification(maildata))
Esempio n. 22
0
 def addReviewer(self, reviewer):
     """ Adds a reviewer to this contribution.
         reviewer has to be an Avatar object.
     """
     if reviewer in self.getReviewersList():
         raise MaKaCError(
             "This contribution is already assigned to the chosen reviewer")
     elif self.hasReferee():
         self._reviewersList.append(reviewer)
         self.notifyModification()
         reviewer.linkTo(self._contribution, "reviewer")
         self.getConfReview().addReviewerContribution(
             reviewer, self._contribution)
         self.getLastReview().setReviewerDueDate(
             self.getConfReview().getDefaultReviewerDueDate())
         if self.getLastReview().getAdviceFrom(reviewer) is None:
             self.getLastReview().addReviewerJudgement(reviewer)
         notification = ContributionReviewingNotification(
             reviewer, 'Reviewer', self._contribution)
         GenericMailer.sendAndLog(notification,
                                  self._contribution.getConference(),
                                  "MaKaC/reviewing.py", reviewer)
     else:
         raise MaKaCError(
             "Please choose a referee before assigning a reviewer")
Esempio n. 23
0
 def _send_confirmation(self, email):
     token_storage = GenericCache('confirm-email')
     data = {'email': email, 'user_id': self.user.id}
     token = make_unique_token(lambda t: not token_storage.get(t))
     token_storage.set(token, data, 24 * 3600)
     GenericMailer.send(make_email(email, template=get_template_module('users/emails/verify_email.txt',
                                                                       user=self.user, email=email, token=token)))
    def _process(self):
        canManageRegistration = self._conf.canManageRegistration(self._getUser())
        if not canManageRegistration and not self._regForm.isActivated():
            p = registrationForm.WPRegFormInactive(self, self._conf)
            return p.display()
        params = self._getRequestParams()
        email = self._regForm.getPersonalData().getValueFromParams(params, 'email')
        if email is None:
            raise FormValuesError(_("An email address has to be set in order to make the registration in the event."))
        elif not validMail(email, False):
            raise FormValuesError(_("The given email address is not valid."))
        matchedUsers = AvatarHolder().match({"email": email}, exact=1)
        if matchedUsers:
            user = matchedUsers[0]
        else:
            user = None
        # Check if the user can register
        if not canManageRegistration:  # normal user registering. Managers can.
            if self._conf.getRegistrationForm().isFull():
                self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf))
                return
            elif not self._conf.getRegistrationForm().inRegistrationPeriod():
                p = registrationForm.WPRegistrationFormClosed(self, self._conf)
                return p.display()
        if user is None:
            if self._conf.hasRegistrantByEmail(email):
                raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email)
        else:
            if user.isRegisteredInConf(self._conf) or self._conf.hasRegistrantByEmail(email):
                if canManageRegistration:
                    raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email)
                else:
                    raise FormValuesError("You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference." % email)

        rp = registration.Registrant()
        self._conf.addRegistrant(rp, user)
        rp.setValues(self._getRequestParams(), user)

        if user is not None:
            user.addRegistrant(rp)
            rp.setAvatar(user)

        # This creates the email to the new registrant and SENDS the email to the organizers if necessary... WTF.
        email = self._regForm.getNotification().createEmailNewRegistrant(self._regForm, rp)
        if self._regForm.isSendRegEmail() and rp.getEmail().strip():
            modEticket = self._conf.getRegistrationForm().getETicket()

            if modEticket.isEnabled() and modEticket.isAttachedToEmail():
                attachment = {
                    'name': "{0}-Ticket.pdf".format(self._target.getTitle()),
                    'binary': TicketToPDF(self._target, rp).getPDFBin(),
                }
                email["attachments"] = [attachment]
            GenericMailer.send(email)

        if canManageRegistration and user != self._getUser():
            self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
        else:
            self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
Esempio n. 25
0
 def _invokeMethodRetryBefore(self):
     # clear/init fossil cache
     fossilize.clearCache()
     # clear after-commit queue
     flush_after_commit_queue(False)
     # delete all queued emails
     GenericMailer.flushQueue(False)
     DBMgr.getInstance().sync()
Esempio n. 26
0
 def _invokeMethodRetryBefore(self):
     # clear/init fossil cache
     fossilize.clearCache()
     # clear after-commit queue
     flush_after_commit_queue(False)
     # delete all queued emails
     GenericMailer.flushQueue(False)
     DBMgr.getInstance().sync()
    def _process(self):
        canManageRegistration = self._conf.canManageRegistration(self._getUser())
        if not canManageRegistration and not self._regForm.isActivated():
            p = registrationForm.WPRegFormInactive(self, self._conf)
            return p.display()
        params = self._getRequestParams()
        email = self._regForm.getPersonalData().getValueFromParams(params, "email")
        if email is None:
            raise FormValuesError(_("An email address has to be set in order to make the registration in the event."))
        elif not validMail(email, False):
            raise FormValuesError(_("The given email address is not valid."))
        matchedUsers = AvatarHolder().match({"email": email}, exact=1)
        if matchedUsers:
            user = matchedUsers[0]
        else:
            user = None
        # Check if the user can register
        if not canManageRegistration:  # normal user registering. Managers can.
            if self._conf.getRegistrationForm().isFull():
                self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf))
                return
            elif not self._conf.getRegistrationForm().inRegistrationPeriod():
                p = registrationForm.WPRegistrationFormClosed(self, self._conf)
                return p.display()
        if user is None:
            if self._conf.hasRegistrantByEmail(email):
                raise FormValuesError('There is already a user with the email "%s". Please choose another one' % email)
        else:
            if user.isRegisteredInConf(self._conf):
                self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf))
                return
            if self._conf.hasRegistrantByEmail(email):
                if canManageRegistration:
                    raise FormValuesError(
                        'There is already a user with the email "%s". Please choose another one' % email
                    )
                else:
                    raise FormValuesError(
                        'You have already registered with the email address "%s". If you need to modify your registration, please contact the managers of the conference.'
                        % email
                    )

        rp = registration.Registrant()
        self._conf.addRegistrant(rp)
        rp.setValues(self._getRequestParams(), user)
        rp.setSessionBillingEnabled(self._regForm.getSessionsForm().getType() != "2priorities")
        if user is not None:
            user.addRegistrant(rp)
            rp.setAvatar(user)
        # avoid multiple sending in case of db conflict
        email = self._regForm.getNotification().createEmailNewRegistrant(self._regForm, rp)
        if email:
            GenericMailer.send(email)
        if not canManageRegistration:
            self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
        else:
            self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
Esempio n. 28
0
    def send( self ):
        minfo = HelperMaKaCInfo.getMaKaCInfoInstance()
        name = self._user.getStraightFullName()
        text = """Dear Administrator,
%s has created a new account in Indico.
<%s>
""" % (name,urlHandlers.UHUserDetails.getURL( self._user ))
        maildata = { "fromAddr": "Indico Mailer<%s>" % minfo.getSupportEmail(), "toList": minfo.getAdminEmails(), "subject": _("[Indico] New account creation"), "body": text }
        GenericMailer.send(GenericNotification(maildata))
Esempio n. 29
0
    def approve(self, sendNotification=True):
        """
        Approve the room blocking and reject colloding bookings
        """
        self.active = True
        # If the blocking has not been saved yet, don't reject anything - will be done later in block.insert()
        if self.block.id is None:
            return
        # Create a fake reservation candidate to find bookings colliding with the blocking
        candResv = Location.parse(self.room.locationName).factory.newReservation()
        candResv.room = self.room
        candResv.startDT = datetime.datetime.combine(self.block.startDate, datetime.time())
        candResv.endDT = datetime.datetime.combine(self.block.endDate, datetime.time(23, 59))
        candResv.repeatability = RepeatabilityEnum.daily
        candResv.isConfirmed = None
        collisions = candResv.getCollisions()
        rejectionReason = "Conflict with blocking %s: %s" % (self.block.id, self.block.message)
        emailsToBeSent = []
        for coll in collisions:
            collResv = coll.withReservation
            if collResv.isRejected:
                continue
            elif self.block.canOverride(collResv.createdByUser(), self.room):
                continue
            elif collResv.repeatability is None or (
                collResv.startDT.date() >= self.block.startDate and collResv.endDT.date() <= self.block.endDate
            ):
                collResv.rejectionReason = rejectionReason
                collResv.reject()  # Just sets isRejected = True
                collResv.update()
                emails = collResv.notifyAboutRejection()
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking rejected")
                info.append("Reason: '%s'" % collResv.rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
            else:  # repeatable -> only reject the specific days
                rejectDate = coll.startDT.date()
                collResv.excludeDay(rejectDate, unindex=True)
                collResv.update()
                emails = collResv.notifyAboutRejection(date=rejectDate, reason=rejectionReason)
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking occurence of the %s rejected" % rejectDate.strftime("%d %b %Y"))
                info.append("Reason: '%s'" % rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
        if sendNotification:
            emailsToBeSent += RoomBlockingNotification.blockingRequestProcessed(self)
        for email in emailsToBeSent:
            GenericMailer.send(GenericNotification(email))
Esempio n. 30
0
def _send_confirmation(email, salt, endpoint, template, template_args=None, url_args=None, data=None):
    template_args = template_args or {}
    url_args = url_args or {}
    token = secure_serializer.dumps(data or email, salt=salt)
    url = url_for(endpoint, token=token, _external=True, _secure=True, **url_args)
    template_module = get_template_module(template, email=email, url=url, **template_args)
    GenericMailer.send(make_email(email, template=template_module))
    flash(_('We have sent you a verification email. Please check your mailbox within the next hour and open '
            'the link in that email.'))
    return redirect(url_for(endpoint, **url_args))
Esempio n. 31
0
def _send_confirmation(email, salt, endpoint, template, template_args=None, url_args=None, data=None):
    template_args = template_args or {}
    url_args = url_args or {}
    token = secure_serializer.dumps(data or email, salt=salt)
    url = url_for(endpoint, token=token, _external=True, _secure=True, **url_args)
    template_module = get_template_module(template, email=email, url=url, **template_args)
    GenericMailer.send(make_email(email, template=template_module))
    flash(_('We have sent you a verification email. Please check your mailbox within the next hour and open '
            'the link in that email.'))
    return redirect(url_for(endpoint, **url_args))
Esempio n. 32
0
    def _invokeMethodSuccess(self):
        rh = ContextManager.get('currentRH')

        flush_after_commit_queue(True)  # run after-commit functions
        GenericMailer.flushQueue(True)  # send emails
        if rh._redisPipeline:
            try:
                rh._redisPipeline.execute()
            except RedisError:
                Logger.get('redis').exception('Could not execute pipeline')
Esempio n. 33
0
 def _delete(self):
     if MailTools.needToSendEmails('RecordingRequest'):
         try:
             notification = RequestDeletedNotification(self)
             GenericMailer.sendAndLog(notification, self.getConference(),
                                      self.getPlugin().getName())
         except Exception,e:
             Logger.get('RecReq').exception(
                 """Could not send RequestDeletedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
             return RecordingRequestError('remove', e)
 def removeAllReviewers(self):
     """ Removes all the reviewers for this contribution
     """
     for reviewer in self._reviewersList:
         reviewer.unlinkTo(self._contribution, "reviewer")
         self.getConfReview().removeReviewerContribution(reviewer, self._contribution)
         self.notifyModification()
         notification = ContributionReviewingRemoveNotification(reviewer, 'Reviewer', self._contribution)
         GenericMailer.sendAndLog(notification, self._contribution.getConference(), "MaKaC/reviewing.py", reviewer)
     del(self._reviewersList[:])
Esempio n. 35
0
    def _invokeMethodSuccess(self):
        rh = ContextManager.get('currentRH')

        flush_after_commit_queue(True)  # run after-commit functions
        GenericMailer.flushQueue(True)  # send emails
        if rh._redisPipeline:
            try:
                rh._redisPipeline.execute()
            except RedisError:
                Logger.get('redis').exception('Could not execute pipeline')
Esempio n. 36
0
 def wrapper(*args, **kwargs):
     mails = fn(*args, **kwargs)
     if mails is None:
         return
     if isinstance(mails, GeneratorType):
         mails = list(mails)
     elif not isinstance(mails, list):
         mails = [mails]
     for mail in filter(None, mails):
         GenericMailer.send(GenericNotification(mail))
Esempio n. 37
0
 def _sendResultEmail(cls, maxDate, previousTotal, newTotal, error, attainedDate):
     """ Sends a mail detailing how the operation went
     """
     if MailTools.needToSendEmails('Vidyo'):
         try:
             notification = VidyoCleaningDoneNotification(maxDate, previousTotal, newTotal, error, attainedDate)
             GenericMailer.send(notification)
         except Exception, e:
             Logger.get('Vidyo').error(
                 """Could not send VidyoCleaningDoneNotification, exception: %s""" % str(e))
 def removeEditor(self):
     """ Removes the editor for this contribution.
         There is no 'editor' argument because there is only 1 editor by contribution.
         The ex-editor is notified by an email.
     """
     self._editor.unlinkTo(self._contribution, "editor")
     self.getConfReview().removeEditorContribution(self._editor, self._contribution)
     notification = ContributionReviewingRemoveNotification(self._editor, 'Editor', self._contribution)
     GenericMailer.sendAndLog(notification, self._contribution.getConference(), "MaKaC/reviewing.py", self._editor)
     self._editor = None
Esempio n. 39
0
 def wrapper(*args, **kwargs):
     mails = fn(*args, **kwargs)
     if mails is None:
         return
     if isinstance(mails, GeneratorType):
         mails = list(mails)
     elif not isinstance(mails, list):
         mails = [mails]
     for mail in filter(None, mails):
         GenericMailer.send(GenericNotification(mail))
Esempio n. 40
0
 def _delete(self):
     if MailTools.needToSendEmails('RecordingRequest'):
         try:
             notification = RequestDeletedNotification(self)
             GenericMailer.sendAndLog(notification, self.getConference(),
                                      self.getPlugin().getName())
         except Exception,e:
             Logger.get('RecReq').exception(
                 """Could not send RequestDeletedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
             return RecordingRequestError('remove', e)
Esempio n. 41
0
    def send( notification ):
        info = HelperMaKaCInfo.getMaKaCInfoInstance()
        fromAddr = "%s <%s>"%(info.getTitle(), info.getSupportEmail())
        toAddr = str(notification.getDestination().getEmail())
        text = """%s
-- 
Indico project <http://cern.ch/indico>
                """%(notification.getMsg())
        maildata = { "fromAddr": fromAddr, "toList": [toAddr], "subject": "[Indico] %s"%notification.getSubject(), "body": text }
        GenericMailer.send(GenericNotification(maildata))
Esempio n. 42
0
    def invokeMethod(self, method, params, req):

        MAX_RETRIES = 10

        # clear the context
        ContextManager.destroy()

        DBMgr.getInstance().startRequest()

        # room booking database
        _startRequestSpecific2RH()

        # notify components that the request has started
        self._notify('requestStarted', req)

        forcedConflicts = Config.getInstance().getForceConflicts()
        retry = MAX_RETRIES
        try:
            while retry > 0:
                if retry < MAX_RETRIES:
                    # notify components that the request is being retried
                    self._notify('requestRetry', req, MAX_RETRIES - retry)

                try:
                    # delete all queued emails
                    GenericMailer.flushQueue(False)

                    DBMgr.getInstance().sync()

                    try:
                        result = processRequest(method, copy.deepcopy(params),
                                                req)
                    except MaKaC.errors.NoReportError, e:
                        raise NoReportError(e.getMsg())

                    # notify components that the request has ended
                    self._notify('requestFinished', req)
                    # Raise a conflict error if enabled. This allows detecting conflict-related issues easily.
                    if retry > (MAX_RETRIES - forcedConflicts):
                        raise ConflictError
                    _endRequestSpecific2RH(True)
                    DBMgr.getInstance().endRequest(True)
                    GenericMailer.flushQueue(True)  # send emails
                    break
                except ConflictError:
                    _abortSpecific2RH()
                    DBMgr.getInstance().abort()
                    retry -= 1
                    continue
                except ClientDisconnected:
                    _abortSpecific2RH()
                    DBMgr.getInstance().abort()
                    retry -= 1
                    time.sleep(MAX_RETRIES - retry)
                    continue
Esempio n. 43
0
    def approve(self, sendNotification=True):
        """
        Approve the room blocking and reject colloding bookings
        """
        self.active = True
        # If the blocking has not been saved yet, don't reject anything - will be done later in block.insert()
        if self.block.id is None:
            return
        # Create a fake reservation candidate to find bookings colliding with the blocking
        candResv = Location.parse(self.room.locationName).factory.newReservation()
        candResv.room = self.room
        candResv.startDT = datetime.datetime.combine(self.block.startDate, datetime.time())
        candResv.endDT = datetime.datetime.combine(self.block.endDate, datetime.time(23, 59))
        candResv.repeatability = RepeatabilityEnum.daily
        candResv.isConfirmed = None
        collisions = candResv.getCollisions()
        rejectionReason = "Conflict with blocking %s: %s" % (self.block.id, self.block.message)
        emailsToBeSent = []
        for coll in collisions:
            collResv = coll.withReservation
            if collResv.isRejected:
                continue
            elif self.block.canOverride(collResv.createdByUser(), self.room):
                continue
            elif (collResv.repeatability is None or
                (collResv.startDT.date() >= self.block.startDate and collResv.endDT.date() <= self.block.endDate)):
                collResv.rejectionReason = rejectionReason
                collResv.reject() # Just sets isRejected = True
                collResv.update()
                emails = collResv.notifyAboutRejection()
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking rejected")
                info.append("Reason: '%s'" % collResv.rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
            else: # repeatable -> only reject the specific days
                rejectDate = coll.startDT.date()
                collResv.excludeDay(rejectDate, unindex=True)
                collResv.update()
                emails = collResv.notifyAboutRejection(date=rejectDate, reason=rejectionReason)
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking occurence of the %s rejected" % rejectDate.strftime("%d %b %Y"))
                info.append("Reason: '%s'" % rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
        if sendNotification:
            emailsToBeSent += RoomBlockingNotification.blockingRequestProcessed(self)
        for email in emailsToBeSent:
            GenericMailer.send(GenericNotification(email))
    def removeReferee(self):
        """ Removes the referee for this contribution.
            There is no 'referee' argument because there is only 1 referee by contribution.
            The ex-referee is notified by an email.
        """

        self._referee.unlinkTo(self._contribution, "referee")
        self.getConfReview().removeRefereeContribution(self._referee, self._contribution)
        notification = ContributionReviewingRemoveNotification(self._referee, 'Referee', self._contribution)
        GenericMailer.sendAndLog(notification, self._contribution.getConference(), "MaKaC/reviewing.py", self._referee)
        self._referee = None
 def sendNotificationEmail(self, widthdrawn = False):
     """ Sends an email to the contribution's authors when the referee, editor or reviewer
         pass a judgement on the contribution.
     """
     authorList = self.getReviewManager().getContribution().getAuthorList()
     for author in authorList:
         if widthdrawn:
             notification = ContributionReviewingJudgementWithdrawalNotification(author, self, self.getReviewManager().getContribution())
         else:
             notification = ContributionReviewingJudgementNotification(author, self, self.getReviewManager().getContribution())
         GenericMailer.sendAndLog(notification, self._review.getConference(), "MaKaC/reviewing.py", author)
Esempio n. 46
0
    def send( self ):
        minfo=HelperMaKaCInfo.getMaKaCInfoInstance()
        text =  _("""Welcome to Indico,
Your registration has been accepted by the site administrator.

You can now login using the following username: %s

Thank you for using Indico.
                """)%(self._user.getIdentityList()[0].getLogin())
        maildata = { "fromAddr": "Indico Mailer<%s>"%minfo.getSupportEmail(), "toList": [self._user.getEmail()], "subject": _("[%s] Registration accepted")%getSubjectIndicoTitle(), "body": text }
        GenericMailer.send(GenericNotification(maildata))
Esempio n. 47
0
 def notifyLocationChange(self):
     if MailTools.needToSendEmails('WebcastRequest'):
         try:
             notification = RequestRelocatedNotification(self)
             GenericMailer.sendAndLog(notification, self.getConference(),
                                  "MaKaC/plugins/Collaboration/WebcastRequest/collaboration.py",
                                  self.getConference().getCreator())
         except Exception,e:
             Logger.get('RecReq').exception(
                 """Could not send RequestRelocatedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
             return WebcastRequestError('edit', e)
Esempio n. 48
0
 def notifyLocationChange(self):
     self.unindex_instances()
     self.index_instances()
     if MailTools.needToSendEmails('WebcastRequest'):
         try:
             notification = RequestRelocatedNotification(self)
             GenericMailer.sendAndLog(notification, self.getConference(),
                                      self.getPlugin().getName())
         except Exception,e:
             Logger.get('RecReq').exception(
                 """Could not send RequestRelocatedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
             return WebcastRequestError('edit', e)
Esempio n. 49
0
 def notifyEventDateChanges(self, oldStartDate, newStartDate, oldEndDate, newEndDate):
     manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
     manager._changeConfStartDateInIndex(self, oldStartDate, newStartDate)
     if MailTools.needToSendEmails('WebcastRequest'):
         try:
             notification = RequestRescheduledNotification(self)
             GenericMailer.sendAndLog(notification, self.getConference(),
                                      self.getPlugin().getName())
         except Exception,e:
             Logger.get('RecReq').exception(
                 """Could not send RequestRescheduledNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
             return WebcastRequestError('edit', e)
Esempio n. 50
0
 def send(addto, addcc, addfrom, subject, body):
     addto = addto.replace("\r\n", "")
     tolist = addto.split(",")
     cclist = addcc.split(",")
     maildata = {
         "fromAddr": addfrom,
         "toList": tolist,
         "ccList": cclist,
         "subject": subject,
         "body": body
     }
     GenericMailer.send(GenericNotification(maildata))
Esempio n. 51
0
 def removeEditor(self):
     """ Removes the editor for this contribution.
         There is no 'editor' argument because there is only 1 editor by contribution.
         The ex-editor is notified by an email.
     """
     editor = self.getEditor()
     self.getConfPaperReview().removeEditorContribution(editor, self.contribution)
     #e-mail notification will be send when editor is removed from contribution only if the manager enable the option in 'Automatic e-mails' section
     if self.getConfPaperReview().getEnableEditorEmailNotifForContribution():
         notification = ContributionReviewingRemoveNotification(editor.user, 'Layout Reviewer', self.contribution)
         GenericMailer.sendAndLog(notification, self.contribution.event_new.as_legacy, 'Paper Reviewing')
     self._editor = None
Esempio n. 52
0
 def send(addto, addcc, addfrom, subject, body):
     addto = addto.replace("\r\n","")
     tolist = addto.split(",")
     cclist = addcc.split(",")
     maildata = {
         "fromAddr": addfrom,
         "toList": tolist,
         "ccList": cclist,
         "subject": subject,
         "body": body
         }
     GenericMailer.send(GenericNotification(maildata))
Esempio n. 53
0
    def _accept(self, user = None):
        self._statusMessage = "Request accepted"
        self._statusClass = "statusMessageOK"

        try:
            notification = RequestAcceptedNotification(self)
            GenericMailer.sendAndLog(notification, self.getConference(),
                                     self.getPlugin().getName())
        except Exception,e:
            Logger.get('RecReq').exception(
                """Could not send RequestAcceptedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
            return RecordingRequestError('accept', e)
Esempio n. 54
0
    def _reject(self):
        self._statusMessage = "Request rejected by responsible"
        self._statusClass = "statusMessageError"

        try:
            notification = RequestRejectedNotification(self)
            GenericMailer.sendAndLog(notification, self.getConference(),
                                     self.getPlugin().getName())
        except Exception,e:
            Logger.get('RecReq').exception(
                """Could not send RequestRejectedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
            return RecordingRequestError('reject', e)
Esempio n. 55
0
 def notifyEventDateChanges(self, oldStartDate, newStartDate, oldEndDate, newEndDate):
     manager = self._conf.getCSBookingManager()
     manager._changeConfStartDateInIndex(self, oldStartDate, newStartDate)
     if MailTools.needToSendEmails('RecordingRequest'):
         try:
             notification = RequestRescheduledNotification(self)
             GenericMailer.sendAndLog(notification, self.getConference(),
                                      self.getPlugin().getName())
         except Exception,e:
             Logger.get('RecReq').exception(
                 """Could not send RequestRescheduledNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
             return RecordingRequestError('edit', e)
Esempio n. 56
0
 def notifyLocationChange(self):
     self.unindex_instances()
     self.index_instances()
     if MailTools.needToSendEmails('RecordingRequest'):
         try:
             notification = RequestRelocatedNotification(self)
             GenericMailer.sendAndLog(notification, self.getConference(),
                                      self.getPlugin().getName())
         except Exception,e:
             Logger.get('RecReq').exception(
                 """Could not send RequestRelocatedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
             return RecordingRequestError('edit', e)
Esempio n. 57
0
 def reject(self, user=None, reason=None, sendNotification=True):
     """
     Reject the room blocking
     """
     self.active = False
     if reason:
         self.rejectionReason = reason
     if user:
         self.rejectedBy = user.getFullName()
     emails = RoomBlockingNotification.blockingRequestProcessed(self)
     for email in emails:
         GenericMailer.send(GenericNotification(email))