45 "You have received a new Notification.") |
45 "You have received a new Notification.") |
46 |
46 |
47 DEF_INVITATION_MSG_FMT = ugettext( |
47 DEF_INVITATION_MSG_FMT = ugettext( |
48 "Invitation to become a %(role_verbose)s for %(group)s.") |
48 "Invitation to become a %(role_verbose)s for %(group)s.") |
49 |
49 |
50 DEF_NEW_CLUB_MSG_FMT = ugettext( |
50 DEF_NEW_GROUP_MSG_FMT = ugettext( |
51 "Your club application for %(name)s has been accepted.") |
51 "Your %(application_type)s for %(group_name)s has been accepted.") |
52 |
52 |
53 DEF_WELCOME_MSG_FMT = ugettext("Welcome to Melange %(name)s,") |
53 DEF_WELCOME_MSG_FMT = ugettext("Welcome to Melange %(name)s,") |
54 |
54 |
55 DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE = 'soc/notification/messages/invitation.html' |
55 DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE = 'soc/notification/messages/invitation.html' |
56 |
56 |
57 DEF_NEW_CLUB_TEMPLATE = 'soc/club/messages/accepted.html' |
57 DEF_NEW_GROUP_TEMPLATE = 'soc/group/messages/accepted.html' |
58 |
58 |
59 |
59 |
60 def sendInviteNotification(entity): |
60 def sendInviteNotification(entity): |
61 """Sends out an invite notification to the user the request is for. |
61 """Sends out an invite notification to the user the request is for. |
62 |
62 |
87 template = DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE |
87 template = DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE |
88 |
88 |
89 sendNotification(to_user, message_properties, subject, template) |
89 sendNotification(to_user, message_properties, subject, template) |
90 |
90 |
91 |
91 |
92 def sendNewClubNotification(entity): |
92 def sendNewGroupNotification(entity, params): |
93 """Sends out an invite notification to the applicant of the club. |
93 """Sends out an invite notification to the applicant of the group. |
94 |
94 |
95 Args: |
95 Args: |
96 entity : An accepted club application |
96 entity : An accepted group application |
97 """ |
97 """ |
98 |
98 |
99 to_user = entity.applicant |
99 to_user = entity.applicant |
100 |
100 |
101 url = "http://%(host)s/club/applicant/%(key_name)s" % { |
101 url = "http://%(host)s%(redirect)s" % { |
102 'host' : os.environ['HTTP_HOST'], |
102 'redirect': redirects.getApplicantRedirect(entity, |
103 'key_name': entity.key().name(), |
103 {'url_name': params['group_url_name']}), |
|
104 'host': os.environ['HTTP_HOST'], |
104 } |
105 } |
105 |
106 |
106 message_properties = { |
107 message_properties = { |
107 'club_name': entity.name, |
108 'group_name': entity.name, |
108 'url': url, |
109 'url': url, |
109 } |
110 } |
110 |
111 |
111 subject = DEF_NEW_CLUB_MSG_FMT % { |
112 subject = DEF_NEW_GROUP_MSG_FMT % { |
112 'name': entity.name, |
113 'application_type': params['name'], |
113 } |
114 'group_name': entity.name, |
114 |
115 } |
115 template = DEF_NEW_CLUB_TEMPLATE |
116 |
|
117 template = DEF_NEW_GROUP_TEMPLATE |
116 |
118 |
117 sendNotification(to_user, message_properties, subject, template) |
119 sendNotification(to_user, message_properties, subject, template) |
118 |
120 |
119 |
121 |
120 def sendNotification(to_user, message_properties, subject, template): |
122 def sendNotification(to_user, message_properties, subject, template): |