177 'index': redirects.getPublicRedirect(notification_entity, |
177 'index': redirects.getPublicRedirect(notification_entity, |
178 model_view.notification.view.getParams())} |
178 model_view.notification.view.getParams())} |
179 |
179 |
180 sender = mail_dispatcher.getDefaultMailSender() |
180 sender = mail_dispatcher.getDefaultMailSender() |
181 |
181 |
182 if not sender: |
182 # get the default mail sender |
|
183 default_sender = mail_dispatcher.getDefaultMailSender() |
|
184 |
|
185 if not default_sender: |
183 # no valid sender found, abort |
186 # no valid sender found, abort |
184 return |
187 return |
|
188 else: |
|
189 (sender_name, sender) = default_sender |
185 |
190 |
186 to = accounts.denormalizeAccount(notification_entity.scope.account).email() |
191 to = accounts.denormalizeAccount(notification_entity.scope.account).email() |
187 |
192 |
188 # create the message contents |
193 # create the message contents |
189 messageProperties = { |
194 messageProperties = { |
190 'to_name': notification_entity.scope.name, |
195 'to_name': notification_entity.scope.name, |
191 'sender_name': current_user_entity.name, |
196 'sender_name': sender_name, |
192 'to': to, |
197 'to': to, |
193 'sender': sender, |
198 'sender': sender, |
194 'subject': force_unicode(DEF_NEW_NOTIFICATION_MSG), |
199 'subject': force_unicode(DEF_NEW_NOTIFICATION_MSG), |
195 'notification' : notification_entity, |
200 'notification' : notification_entity, |
196 'notification_url' : notification_url |
201 'notification_url' : notification_url |
211 # get site name |
216 # get site name |
212 site_entity = model_logic.site.logic.getSingleton() |
217 site_entity = model_logic.site.logic.getSingleton() |
213 site_name = site_entity.site_name |
218 site_name = site_entity.site_name |
214 |
219 |
215 # get the default mail sender |
220 # get the default mail sender |
216 sender = mail_dispatcher.getDefaultMailSender() |
221 default_sender = mail_dispatcher.getDefaultMailSender() |
217 |
222 |
218 if not sender: |
223 if not default_sender: |
219 # no valid sender found, should not happen but abort anyway |
224 # no valid sender found, should not happen but abort anyway |
220 return |
225 return |
|
226 else: |
|
227 (sender_name, sender) = default_sender |
221 |
228 |
222 to = accounts.denormalizeAccount(user_entity.account).email() |
229 to = accounts.denormalizeAccount(user_entity.account).email() |
223 |
230 |
224 # create the message contents |
231 # create the message contents |
225 messageProperties = { |
232 messageProperties = { |
226 'to_name': user_entity.name, |
233 'to_name': user_entity.name, |
227 'sender_name': site_name, |
234 'sender_name': sender_name, |
228 'site_name': site_name, |
235 'site_name': site_name, |
229 'to': to, |
236 'to': to, |
230 'sender': sender, |
237 'sender': sender, |
231 'subject': DEF_WELCOME_MSG_FMT % { |
238 'subject': DEF_WELCOME_MSG_FMT % { |
232 'site_name': site_name, |
239 'site_name': site_name, |