1 From ee69d45f1a7f928f7b241702e9be06007444115e Mon Sep 17 00:00:00 2001
2 From: Lumir Balhar <lbalhar@redhat.com>
3 Date: Fri, 30 Aug 2019 10:59:43 +0200
4 Subject: [PATCH] Use `html` module in Python 3 and cgi module in Python 2
6 `cgi.escape()` has been deprecated since Python 3.2 and
7 removed from Python 3.8.
9 Fixes: https://github.com/Cue/scales/issues/46
11 src/greplin/scales/formats.py | 10 +++++++---
12 1 file changed, 7 insertions(+), 3 deletions(-)
14 diff --git a/src/greplin/scales/formats.py b/src/greplin/scales/formats.py
15 index c4ef979..b6a96d4 100644
16 --- a/src/greplin/scales/formats.py
17 +++ b/src/greplin/scales/formats.py
20 from greplin import scales
26 + # Python 2.7 has no html module
31 @@ -105,7 +109,7 @@ def _htmlRenderDict(pathParts, statDict, output):
33 output.write('<div class="level">')
35 - keyStr = cgi.escape(_utf8str(key))
36 + keyStr = html.escape(_utf8str(key))
38 if hasattr(value, '__call__'):
40 @@ -119,7 +123,7 @@ def _htmlRenderDict(pathParts, statDict, output):
41 _htmlRenderDict(valuePath, value, output)
43 output.write('<div><span class="key">%s</span> <span class="%s">%s</span></div>' %
44 - (keyStr, type(value).__name__, cgi.escape(_utf8str(value)).replace('\n', '<br/>')))
45 + (keyStr, type(value).__name__, html.escape(_utf8str(value)).replace('\n', '<br/>')))