app/soc/views/models/org_app.py
changeset 2170 cec46675f866
parent 2160 3f9dd37d98a8
child 2171 83d96aadd228
equal deleted inserted replaced
2169:79bb965e723a 2170:cec46675f866
   220         return
   220         return
   221       else:
   221       else:
   222         (sender_name, sender) = default_sender
   222         (sender_name, sender) = default_sender
   223 
   223 
   224       # construct the contents of the email
   224       # construct the contents of the email
   225       user_entity = app_entity.applicant
   225       admin_entity = app_entity.applicant
   226       to = accounts.denormalizeAccount(user_entity.account).email()
   226       backup_entity = app_entity.backup_admin
   227 
   227 
   228       context = {'sender': sender,
   228       context = {
   229               'to': to,
   229           'sender': sender,
   230               'sender_name': sender_name,
   230           'sender_name': sender_name,
   231               'to_name': user_entity.name,
   231           'program_name': app_entity.scope.name,
   232               'program_name': app_entity.scope.name,
   232           'org_app_name': app_entity.name
   233               'org_app_name': app_entity.name}
   233           }
   234 
   234 
   235       if status == 'accepted':
   235       if status == 'accepted':
   236         # use the accepted template and subject
   236         # use the accepted template and subject
   237         template = params['accepted_mail_template']
   237         template = params['accepted_mail_template']
   238         context['subject'] = 'Congratulations!'
   238         context['subject'] = 'Congratulations!'
   240       elif status == 'rejected':
   240       elif status == 'rejected':
   241         # use the rejected template and subject
   241         # use the rejected template and subject
   242         template = params['rejected_mail_template']
   242         template = params['rejected_mail_template']
   243         context['subject'] = 'Thank you for your application'
   243         context['subject'] = 'Thank you for your application'
   244 
   244 
   245       # send out the constructed email
   245       for to in [admin_entity, backup_entity]:
   246       mail_dispatcher.sendMailFromTemplate(template, context)
   246         email = accounts.denormalizeAccount(to.account).email()
       
   247         context['to'] = email
       
   248         context['to_name'] = to.name
       
   249 
       
   250         # send out the constructed email
       
   251         mail_dispatcher.sendMailFromTemplate(template, context)
   247 
   252 
   248   @decorators.merge_params
   253   @decorators.merge_params
   249   @decorators.check_access
   254   @decorators.check_access
   250   def bulkAccept(self, request, access_type,
   255   def bulkAccept(self, request, access_type,
   251                page_name=None, params=None, **kwargs):
   256                page_name=None, params=None, **kwargs):