##// END OF EJS Templates
fixes testing email in settings
marcink -
r1798:2ee93fba beta
parent child Browse files
Show More
@@ -228,7 +228,6 b' class SettingsController(BaseController)'
228 prefix_error=False,
228 prefix_error=False,
229 encoding="UTF-8")
229 encoding="UTF-8")
230
230
231
232 if setting_id == 'hooks':
231 if setting_id == 'hooks':
233 ui_key = request.POST.get('new_hook_ui_key')
232 ui_key = request.POST.get('new_hook_ui_key')
234 ui_value = request.POST.get('new_hook_ui_value')
233 ui_value = request.POST.get('new_hook_ui_value')
@@ -242,7 +241,8 b' class SettingsController(BaseController)'
242 # check for edits
241 # check for edits
243 update = False
242 update = False
244 _d = request.POST.dict_of_lists()
243 _d = request.POST.dict_of_lists()
245 for k, v in zip(_d.get('hook_ui_key', []), _d.get('hook_ui_value_new', [])):
244 for k, v in zip(_d.get('hook_ui_key', []),
245 _d.get('hook_ui_value_new', [])):
246 RhodeCodeUi.create_or_update_hook(k, v)
246 RhodeCodeUi.create_or_update_hook(k, v)
247 update = True
247 update = True
248
248
@@ -256,16 +256,18 b' class SettingsController(BaseController)'
256
256
257 return redirect(url('admin_edit_setting', setting_id='hooks'))
257 return redirect(url('admin_edit_setting', setting_id='hooks'))
258
258
259
260
261 if setting_id == 'email':
259 if setting_id == 'email':
262 test_email = request.POST.get('test_email')
260 test_email = request.POST.get('test_email')
263 test_email_subj = 'RhodeCode TestEmail'
261 test_email_subj = 'RhodeCode TestEmail'
264 test_email_body = 'RhodeCode Email test'
262 test_email_body = 'RhodeCode Email test'
263
265 test_email_html_body = EmailNotificationModel()\
264 test_email_html_body = EmailNotificationModel()\
266 .get_email_tmpl(EmailNotificationModel.TYPE_DEFAULT)
265 .get_email_tmpl(EmailNotificationModel.TYPE_DEFAULT,
266 body=test_email_body)
267
267
268 run_task(tasks.send_email, [test_email], test_email_subj,
268 recipients = [test_email] if [test_email] else None
269
270 run_task(tasks.send_email, recipients, test_email_subj,
269 test_email_body, test_email_html_body)
271 test_email_body, test_email_html_body)
270
272
271 h.flash(_('Email task created'), category='success')
273 h.flash(_('Email task created'), category='success')
General Comments 0
You need to be logged in to leave comments. Login now