def load_participants(config): """ load all the participants from the configuration files and :return a list of Person objects. """ people = [] for person in config['PARTICIPANTS']: person = Person.construct_email_recipient(person) if person is not None: people.append(person) return people
def process_data(self): """ TODO: refactor this method. """ participants = self.config['PARTICIPANTS'] if len(participants) < 2: raise Exception('Not enough participants specified.') givers = [] for person in participants: person = Person.construct_santa_recipient(person) givers.append(person) receivers = givers[:] pairs = self.create_pairs(givers, receivers) if self.send_action: self.send_mail(pairs) else: self.logger.info(self.TEMPLATE_MSG % ("\n".join([str(p) for p in pairs]))) return
def process_data(self): """ TODO: refactor this method. """ participants = self.config['PARTICIPANTS'] if len(participants) < 2: raise Exception('Not enough participants specified.') pairs = None if not self.resend: givers = [] for person in participants: person = Person.construct_santa_recipient(person) if self.report: print(person) givers.append(person) receivers = givers[:] pairs = self.create_pairs(givers, receivers) self.logger.info(self.TEMPLATE_MSG % ("\n".join([str(p) for p in pairs]))) if self.send_action or self.resend: self.send_mail(pairs)