rrs_upstream_email: Adapt to template rendering API change

With Django 1.10+, if you use get_template() to retrieve a template,
then you can't pass a context when calling .render() on it, you need to
pass a dict instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-04-18 10:16:33 +12:00
parent 227b9c65af
commit 0b6dac83b5

View File

@ -104,7 +104,7 @@ def send_email(maintplan, recipes, options):
plaintext = get_template('rrs/report_email.txt') plaintext = get_template('rrs/report_email.txt')
site_url = 'http://' + current_site.domain + reverse('rrs_frontpage') site_url = 'http://' + current_site.domain + reverse('rrs_frontpage')
d = Context({ d = {
'maintplan': maintplan, 'maintplan': maintplan,
'site': current_site, 'site': current_site,
'site_url': site_url, 'site_url': site_url,
@ -112,7 +112,7 @@ def send_email(maintplan, recipes, options):
'total_upgradable_count': upgradable_count, 'total_upgradable_count': upgradable_count,
'commits': commits, 'commits': commits,
'recipelines': recipelines, 'recipelines': recipelines,
}) }
text_content = plaintext.render(d) text_content = plaintext.render(d)
msg = EmailMessage(subject_content, text_content, from_email, to_email_list) msg = EmailMessage(subject_content, text_content, from_email, to_email_list)