changeset 1798:2ee93fba129e beta

fixes testing email in settings
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 21 Dec 2011 02:26:15 +0200
parents 6274adc06988
children 6c86c987cf93
files rhodecode/controllers/admin/settings.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/settings.py	Wed Dec 21 02:07:41 2011 +0200
+++ b/rhodecode/controllers/admin/settings.py	Wed Dec 21 02:26:15 2011 +0200
@@ -228,7 +228,6 @@
                      prefix_error=False,
                      encoding="UTF-8")
 
-
         if setting_id == 'hooks':
             ui_key = request.POST.get('new_hook_ui_key')
             ui_value = request.POST.get('new_hook_ui_value')
@@ -242,7 +241,8 @@
                 # check for edits
                 update = False
                 _d = request.POST.dict_of_lists()
-                for k, v in zip(_d.get('hook_ui_key', []), _d.get('hook_ui_value_new', [])):
+                for k, v in zip(_d.get('hook_ui_key', []),
+                                _d.get('hook_ui_value_new', [])):
                     RhodeCodeUi.create_or_update_hook(k, v)
                     update = True
 
@@ -256,16 +256,18 @@
 
             return redirect(url('admin_edit_setting', setting_id='hooks'))
 
-
-
         if setting_id == 'email':
             test_email = request.POST.get('test_email')
             test_email_subj = 'RhodeCode TestEmail'
             test_email_body = 'RhodeCode Email test'
+
             test_email_html_body = EmailNotificationModel()\
-                .get_email_tmpl(EmailNotificationModel.TYPE_DEFAULT)
+                .get_email_tmpl(EmailNotificationModel.TYPE_DEFAULT,
+                                body=test_email_body)
 
-            run_task(tasks.send_email, [test_email], test_email_subj,
+            recipients = [test_email] if [test_email] else None
+
+            run_task(tasks.send_email, recipients, test_email_subj,
                      test_email_body, test_email_html_body)
 
             h.flash(_('Email task created'), category='success')