summary refs log tree commit diff
path: root/synapse/push
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2022-03-24 18:42:04 +0000
committerGitHub <noreply@github.com>2022-03-24 18:42:04 +0000
commit000426095224401649827d6cdc5a7d5e0ef4e17c (patch)
treea298604ca50d4e802d9811d497b2291bf9cb9fb4 /synapse/push
parentupdate changelog for 1.55.1 (diff)
downloadsynapse-000426095224401649827d6cdc5a7d5e0ef4e17c.tar.xz
Revert "Replace instances of deprecated `Jinja2.Markup` with `markupsafe.Markup`" (#12296)
This reverts commit 8810c93e828a9ed1dcb008d08be8aa9fcb4d28c3.
Diffstat (limited to 'synapse/push')
-rw-r--r--synapse/push/mailer.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/push/mailer.py b/synapse/push/mailer.py
index 5ccdd88364..649a4f49d0 100644
--- a/synapse/push/mailer.py
+++ b/synapse/push/mailer.py
@@ -18,7 +18,6 @@ from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, TypeVar
 
 import bleach
 import jinja2
-from markupsafe import Markup
 
 from synapse.api.constants import EventTypes, Membership, RoomTypes
 from synapse.api.errors import StoreError
@@ -868,7 +867,7 @@ class Mailer:
         )
 
 
-def safe_markup(raw_html: str) -> Markup:
+def safe_markup(raw_html: str) -> jinja2.Markup:
     """
     Sanitise a raw HTML string to a set of allowed tags and attributes, and linkify any bare URLs.
 
@@ -878,7 +877,7 @@ def safe_markup(raw_html: str) -> Markup:
     Returns:
         A Markup object ready to safely use in a Jinja template.
     """
-    return Markup(
+    return jinja2.Markup(
         bleach.linkify(
             bleach.clean(
                 raw_html,
@@ -892,7 +891,7 @@ def safe_markup(raw_html: str) -> Markup:
     )
 
 
-def safe_text(raw_text: str) -> Markup:
+def safe_text(raw_text: str) -> jinja2.Markup:
     """
     Sanitise text (escape any HTML tags), and then linkify any bare URLs.
 
@@ -902,7 +901,7 @@ def safe_text(raw_text: str) -> Markup:
     Returns:
         A Markup object ready to safely use in a Jinja template.
     """
-    return Markup(
+    return jinja2.Markup(
         bleach.linkify(bleach.clean(raw_text, tags=[], attributes=[], strip=False))
     )