This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 4fe152d Fix NoneType bug & fill the test recipients with original
recipients if empty (#7365)
4fe152d is described below
commit 4fe152d1560764527c6d8eca19bc91f344c63e5e
Author: ImPerat0R_ <[email protected]>
AuthorDate: Thu Apr 25 13:36:10 2019 +0800
Fix NoneType bug & fill the test recipients with original recipients if
empty (#7365)
---
superset/views/schedules.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/superset/views/schedules.py b/superset/views/schedules.py
index 4dae3cb..6fdae77 100644
--- a/superset/views/schedules.py
+++ b/superset/views/schedules.py
@@ -90,9 +90,12 @@ class EmailScheduleView(SupersetModelView, DeleteMixin):
edit_form_extra_fields = add_form_extra_fields
def process_form(self, form, is_created):
- recipients = form.test_email_recipients.data.strip() or None
+ if form.test_email_recipients.data:
+ test_email_recipients = form.test_email_recipients.data.strip()
+ else:
+ test_email_recipients = None
self._extra_data['test_email'] = form.test_email.data
- self._extra_data['test_email_recipients'] = recipients
+ self._extra_data['test_email_recipients'] = test_email_recipients
def pre_add(self, obj):
try:
@@ -111,7 +114,7 @@ class EmailScheduleView(SupersetModelView, DeleteMixin):
def post_add(self, obj):
# Schedule a test mail if the user requested for it.
if self._extra_data['test_email']:
- recipients = self._extra_data['test_email_recipients']
+ recipients = self._extra_data['test_email_recipients'] or
obj.recipients
args = (self.schedule_type, obj.id)
kwargs = dict(recipients=recipients)
schedule_email_report.apply_async(args=args, kwargs=kwargs)