Пример #1
0
    def _addTask(self, email):
        """Creating a task in order to send reminder emails periodically.
           It's mandatory to implement this method for the specific pending queues"""
        # ------ Creating a task in order to send reminder emails periodically ------
        if not self._hasTask(email):
            # Create the object which send the email
            pedingReminder = self._reminder(email)
            pedingReminder.setId("ReminderPending%s-%s" % (self._id,email))
            # Create the task
            t=task()
            t.addObj(pedingReminder)
            t.setInterval(timedelta(7)) # Remind each 7 days
            nw=nowutc()
            t.setLastDate(nw) # start in 7 days cos the first email was already sent
            t.setEndDate(nw+timedelta(15)) # keep trying during 15 days
            self._tasksIdx.indexTask(email, t)

            Scheduler.addTask(t)