Fixing syntax errors

This commit is contained in:
Kumi 2021-05-30 08:06:33 +02:00
parent 258048654d
commit d14c5af70d

View file

@ -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