Example #1
0
def sendNewGroupNotification(entity, params):
  """Sends out an invite notification to the applicant of the group.

  Args:
    entity : An accepted group application
  """

  url = "http://%(host)s%(redirect)s" % {
      'redirect': redirects.getApplicantRedirect(entity,
      {'url_name': params['group_url_name']}),
      'host': os.environ['HTTP_HOST'],
      }

  message_properties = {
      'application_type': params['name'],
      'group_type': params['group_name'],
      'group_name': entity.name,
      'url': url,
      }

  subject = DEF_NEW_GROUP_MSG_FMT % {
      'application_type': params['name'],
      'group_name': entity.name,
      }

  template = DEF_NEW_GROUP_TEMPLATE

  for to in [entity.applicant, entity.backup_admin]:
    if not to:
      continue

    sendNotification(to, None, message_properties, subject, template)
Example #2
0
def sendNewOrganizationNotification(entity, module_name):
  """Sends out an invite notification to the applicant of the Organization.

  Args:
    entity : An accepted OrgAppRecord
  """

  program_entity = entity.survey.scope

  url = 'http://%(host)s%(redirect)s' % {
      'redirect': redirects.getApplicantRedirect(entity,
      {'url_name': '%s/org' % module_name,
       'program': program_entity}),
      'host': system.getHostname(),
      }

  message_properties = {
      'org_name': entity.name,
      'program_name': program_entity.name,
      'url': url
      }

  subject = DEF_NEW_ORG_MSG_FMT % {
      'group_name': entity.name,
      }

  template = DEF_NEW_ORG_TEMPLATE

  for to in [entity.main_admin, entity.backup_admin]:
    if not to:
      continue

    sendNotification(to, None, message_properties, subject, template)