app/soc/cron/student_proposal_mailer.py
changeset 2365 a66e1dd8ced7
parent 2255 783e69b54d47
equal deleted inserted replaced
2364:a1cbd3143277 2365:a66e1dd8ced7
   147                           'page')
   147                           'page')
   148     else:
   148     else:
   149       (sender_name, sender) = default_sender
   149       (sender_name, sender) = default_sender
   150 
   150 
   151     # construct the contents of the email
   151     # construct the contents of the email
       
   152     # pylint: disable-msg=E1103
   152     student_entity = proposal.scope
   153     student_entity = proposal.scope
   153     program_entity = proposal.program
   154     program_entity = proposal.program
   154 
   155 
   155     context = {
   156     context = {
   156         'to': student_entity.email,
   157         'to': student_entity.email,
   163     # check if the student has an accepted proposal
   164     # check if the student has an accepted proposal
   164     fields['status'] = 'accepted'
   165     fields['status'] = 'accepted'
   165     accepted_proposal = proposal_logic.getForFields(fields, unique=True)
   166     accepted_proposal = proposal_logic.getForFields(fields, unique=True)
   166 
   167 
   167     if accepted_proposal:
   168     if accepted_proposal:
   168       org_entity = accepted_proposal.org
       
   169       # use the accepted template and subject
   169       # use the accepted template and subject
   170       template = DEF_ACCEPTED_MAIL_TEMPLATE
   170       template = DEF_ACCEPTED_MAIL_TEMPLATE
   171       context['subject'] = 'Congratulations!'
   171       context['subject'] = 'Congratulations!'
   172       context['proposal_title'] = accepted_proposal.title
   172       context['proposal_title'] = accepted_proposal.title
   173       context['org_name'] = accepted_proposal.org.name
   173       context['org_name'] = accepted_proposal.org.name