45 "You have received a new Notification.") |
45 "You have received a new Notification.") |
46 |
46 |
47 DEF_INVITATION_MSG_FMT = ugettext_lazy( |
47 DEF_INVITATION_MSG_FMT = ugettext_lazy( |
48 "Invitation to become a %(role)s for %(group)s.") |
48 "Invitation to become a %(role)s for %(group)s.") |
49 |
49 |
|
50 DEF_NEW_CLUB_MSG_FMT = ugettext_lazy( |
|
51 "Your club application for %(name)s has been accepted.") |
|
52 |
50 DEF_WELCOME_MSG_FMT = ugettext_lazy("Welcome to Melange %(name)s,") |
53 DEF_WELCOME_MSG_FMT = ugettext_lazy("Welcome to Melange %(name)s,") |
51 |
54 |
52 DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE = 'soc/notification/messages/invitation.html' |
55 DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE = 'soc/notification/messages/invitation.html' |
53 |
56 |
|
57 DEF_NEW_CLUB_TEMPLATE = 'soc/club/messages/accepted.html' |
54 |
58 |
55 |
59 |
56 def sendInviteNotification(entity): |
60 def sendInviteNotification(entity): |
57 """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. |
58 |
62 |
79 'role' : entity.role, |
83 'role' : entity.role, |
80 'group' : entity.scope.name |
84 'group' : entity.scope.name |
81 } |
85 } |
82 |
86 |
83 template = DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE |
87 template = DEF_GROUP_INVITE_NOTIFICATION_TEMPLATE |
|
88 |
|
89 sendNotification(to_user, message_properties, subject, template) |
|
90 |
|
91 |
|
92 def sendNewClubNotification(entity): |
|
93 """Sends out an invite notification to the applicant of the club |
|
94 |
|
95 Args: |
|
96 entity : An accepted club application |
|
97 """ |
|
98 |
|
99 to_user = entity.applicant |
|
100 |
|
101 url = "http://%(host)s/club/create/%(key_name)s" % { |
|
102 'host' : os.environ['HTTP_HOST'], |
|
103 'key_name': entity.key().name(), |
|
104 } |
|
105 |
|
106 message_properties = { |
|
107 'club_name': entity.name, |
|
108 'url': url, |
|
109 } |
|
110 |
|
111 subject = DEF_NEW_CLUB_MSG_FMT % { |
|
112 'name': entity.name, |
|
113 } |
|
114 |
|
115 template = DEF_NEW_CLUB_TEMPLATE |
84 |
116 |
85 sendNotification(to_user, message_properties, subject, template) |
117 sendNotification(to_user, message_properties, subject, template) |
86 |
118 |
87 |
119 |
88 def sendNotification(to_user, message_properties, subject, template): |
120 def sendNotification(to_user, message_properties, subject, template): |