Skip to content

Commit

Permalink
Change operations order
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Jul 24, 2024
1 parent 876a832 commit 5e6e7bc
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,20 @@ def prepare_message(self):
# Check if there is content
bs_mail_header = BeautifulSoup(mail_header)
bs_mail_footer = BeautifulSoup(mail_footer)
mail_header = bs_mail_header.get_text() and mail_header or None
mail_footer = bs_mail_footer.get_text() and mail_footer or None

portal = getMultiAdapter(
(self.context, self.request), name="plone_portal_state"
).portal()

for snippet in [mail_header, mail_footer]:
for snippet in [bs_mail_header, bs_mail_footer]:
if snippet:
for link in snippet.find_all("a"):
if link.get("href", "").startswith("/"):
link["href"] = portal.absolute_url() + link["href"]

mail_header = bs_mail_header.get_text() and mail_header or None
mail_footer = bs_mail_footer.get_text() and mail_footer or None

message_template = api.content.get_view(
name="send_mail_template",
context=self.context,
Expand Down

0 comments on commit 5e6e7bc

Please sign in to comment.