Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix form in saving email schedule #7365

Merged
merged 1 commit into from
Apr 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions superset/views/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -111,7 +114,7 @@ def pre_update(self, obj):
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)
Expand Down