From d14c5af70d4fec4fd27be060df34028dadfbef73 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sun, 30 May 2021 08:06:33 +0200 Subject: [PATCH] Fixing syntax errors --- mail/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mail/views.py b/mail/views.py index ff20f42..53d507a 100644 --- a/mail/views.py +++ b/mail/views.py @@ -13,7 +13,9 @@ class MailView(ContextMixin): self.html_template_name = html_template_name self.text_template_name = text_template_name - if self._template_name := template_name: + if template_name: + self._template_name = template_name + if len(template_name.split("/")[-1].split(".")[-1] in ("html", "txt")): basename = template_name.rsplit(".", 1)[0] else: @@ -42,7 +44,7 @@ class MailView(ContextMixin): context = self.get_context_data(**kwargs) return render_to_string(self.text_template_name, context) else: - if from_html and html := self.render_to_html(**kwargs): + if from_html and (html := self.render_to_html(**kwargs)): return BeautifulSoup(html).get_text() return None