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_)
if recips:
return ', '.join(recips)
data = email.sample_data(self.request)
data = email.obtain_sample_data(self.request)
return {
'_email': email,
'key': email.key,
@ -299,7 +299,7 @@ class EmailPreview(View):
key = self.request.POST.get('email_key')
if 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)
subject = msg['Subject']
@ -320,7 +320,7 @@ class EmailPreview(View):
def preview_template(self, key, type_):
email = self.handler.get_email(key)
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)
if type_ == 'txt':
self.request.response.content_type = b'text/plain'