def send_emails(d): # clean up some fields utils.dict_remove(d, 'submit') # get context and email function context, emailfun = get_mail_to_send(d.group) results, num_results = applicants.get_applicants(context=context) if d.get('test_applicants', False): print("Sending to test applicants") else: print(("Sending to %i emails") % num_results) for i, applicant in enumerate(results): # send 50 emails then wait 15 sec if i != 0 and i % 50 == 0: time.sleep(15) # send to only test applicants if d.get('test_applicants', False): if "mlssTest_" not in applicant.first_name: continue emailfun(applicant) # send emails to rejected applicants print(i) print(applicant.email) return
def send_emails(d): # clean up some fields utils.dict_remove(d, 'submit') # get admitted applicants if (d.group == 'Admitted First Message' or d.group == 'Admitted Payment Message'): context = "admitted" elif d.group == 'Rejected': context = "rejected" # elif d.group == 'Pending': # context = "pending" # elif d.group == 'All': # context = "all" # Admitted who receive scholarships must be in Pending # they will be handled separately results, num_results = applicants.get_applicants(context=context) print(("Sending to %i emails") % num_results) for applicant in results: # send emails to selected applicants email_sending.to_applicant(applicant, d.subject, d.body) print(applicant.email) return
def submit_reference(applicant, d): # clean up some fields utils.dict_remove(d, 'submit') # add the provided reference add_reference(applicant.secret_md5, d) # notify user and referee by email email_templates.notify_applicant(applicant) email_templates.notify_referee(applicant)
def clean_up_data(d): utils.dict_remove(d, 'resume', 'submit', 'referee_email_again', 'email_again') d.gender = d.gender.lower() ## EDITED BY: rgap #d.pascal_member = d.pascal_member == 'Yes'; d.travel_support = d.get('travel_support', None) and True or None d.affiliated = d.get('affiliated', False) != False
def clean_up_data(d): utils.dict_remove(d, 'resume', 'submit', 'referee_email_again', 'email_again') d.gender = d.gender.lower() d.pascal_member = d.pascal_member == 'Yes'; d.travel_support = d.get('travel_support', None) and True or None; d.affiliated = d.get('affiliated', False) != False;