From a05156821384ee86b120bead84a2ee5a27897928 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Tue, 7 Jun 2022 16:31:29 +0200 Subject: [PATCH] [FIX] runbot: avoid werkzeug deprecated escape The `utils.escape` utility was deprecated in werkzeug 2.0.0, so it can be replaced with our `html_escape` which is itself `markupsafe.escape`. Also, with this change, the double quotes are now escaped in `"` instead of `"`, so we fix the test too. --- runbot/common.py | 5 ++--- runbot/tests/test_event.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/runbot/common.py b/runbot/common.py index d76b57c4..dae520af 100644 --- a/runbot/common.py +++ b/runbot/common.py @@ -13,9 +13,8 @@ from collections import OrderedDict from datetime import timedelta from babel.dates import format_timedelta from markupsafe import Markup -from werkzeug import utils -from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT +from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT, html_escape _logger = logging.getLogger(__name__) @@ -121,7 +120,7 @@ def list_local_dbs(additionnal_conditions=None): def pseudo_markdown(text): - text = utils.escape(text) + text = html_escape(text) # first, extract code blocs: codes = [] diff --git a/runbot/tests/test_event.py b/runbot/tests/test_event.py index 1bb0ebf3..fb945196 100644 --- a/runbot/tests/test_event.py +++ b/runbot/tests/test_event.py @@ -129,5 +129,5 @@ class TestIrLogging(RunbotCase): log.message = 'foo ' self.assertEqual( log._markdown(), - 'foo <script>console.log("hello world")</script>' + 'foo <script>console.log("hello world")</script>' )