Use new Email.obtain_sample_data() method when generating preview

per upstream changes
This commit is contained in:
Lance Edgar 2020-02-07 16:21:51 -06:00
parent f1dc773bfd
commit 6a8f64a9e8

View file

@ -125,7 +125,7 @@ class ProfilesView(MasterView):
recips = email.get_recips(type_) recips = email.get_recips(type_)
if recips: if recips:
return ', '.join(recips) return ', '.join(recips)
data = email.sample_data(self.request) data = email.obtain_sample_data(self.request)
return { return {
'_email': email, '_email': email,
'key': email.key, 'key': email.key,
@ -299,7 +299,7 @@ class EmailPreview(View):
key = self.request.POST.get('email_key') key = self.request.POST.get('email_key')
if key: if key:
email = self.handler.get_email(key) email = self.handler.get_email(key)
data = email.sample_data(self.request) data = email.obtain_sample_data(self.request)
msg = email.make_message(data) msg = email.make_message(data)
subject = msg['Subject'] subject = msg['Subject']
@ -320,7 +320,7 @@ class EmailPreview(View):
def preview_template(self, key, type_): def preview_template(self, key, type_):
email = self.handler.get_email(key) email = self.handler.get_email(key)
template = email.get_template(type_) template = email.get_template(type_)
data = email.sample_data(self.request) data = email.obtain_sample_data(self.request)
self.request.response.text = template.render(**data) self.request.response.text = template.render(**data)
if type_ == 'txt': if type_ == 'txt':
self.request.response.content_type = b'text/plain' self.request.response.content_type = b'text/plain'