From 70e44c5f1ac3d9ed8342afb60dc94f03a7228ce5 Mon Sep 17 00:00:00 2001 From: Sergey Nikitin Date: Tue, 27 Oct 2020 21:49:04 +0400 Subject: [PATCH] FIxed py38 tests Change-Id: Id5f5c4bcee5f3f30e3e8c0ef04e9b7474a76b441 --- stackalytics/processor/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stackalytics/processor/utils.py b/stackalytics/processor/utils.py index ae55b6faf..cc6a45bfc 100644 --- a/stackalytics/processor/utils.py +++ b/stackalytics/processor/utils.py @@ -14,9 +14,9 @@ # limitations under the License. import calendar -import cgi import datetime import gzip +import html import random import re import time @@ -248,7 +248,10 @@ def unwrap_text(text): def format_text(s): - s = cgi.escape(re.sub(re.compile('\n{2,}', flags=re.MULTILINE), '\n', s)) + # TODO(snikitin) Maybe we need to remove 'False' from escape() + # to escape ' and " symbols? + s = html.escape(re.sub(re.compile('\n{2,}', flags=re.MULTILINE), '\n', s), + False) def replace_dots(match_obj): return re.sub(r'([\./]+)', r'\1​', match_obj.group(0))