Convert old python3 cgi method into the new html one

Summary: Patch by Gianfranco Costamagna

Reviewers: serge-sans-paille

Reviewed By: serge-sans-paille

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76126
This commit is contained in:
Gianfranco Costamagna 2020-03-25 22:38:34 +01:00 committed by Sylvestre Ledru
parent 081efa7dd0
commit 4b428e8f18
2 changed files with 4 additions and 4 deletions

View File

@ -3,9 +3,9 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import cgi
import errno import errno
import functools import functools
import html
import io import io
from multiprocessing import cpu_count from multiprocessing import cpu_count
import os.path import os.path
@ -197,7 +197,7 @@ class IndexRenderer:
self.max_hottest_remarks_on_index = max_hottest_remarks_on_index self.max_hottest_remarks_on_index = max_hottest_remarks_on_index
def render_entry(self, r, odd): def render_entry(self, r, odd):
escaped_name = cgi.escape(r.DemangledFunctionName) escaped_name = html.escape(r.DemangledFunctionName)
print(u''' print(u'''
<tr> <tr>
<td class=\"column-entry-{odd}\"><a href={r.Link}>{r.DebugLocString}</a></td> <td class=\"column-entry-{odd}\"><a href={r.Link}>{r.DebugLocString}</a></td>

View File

@ -11,7 +11,7 @@ except ImportError:
print("For faster parsing, you may want to install libYAML for PyYAML") print("For faster parsing, you may want to install libYAML for PyYAML")
from yaml import Loader from yaml import Loader
import cgi import html
from collections import defaultdict from collections import defaultdict
import fnmatch import fnmatch
import functools import functools
@ -159,7 +159,7 @@ class Remark(yaml.YAMLObject):
(key, value) = list(mapping.items())[0] (key, value) = list(mapping.items())[0]
if key == 'Caller' or key == 'Callee' or key == 'DirectCallee': if key == 'Caller' or key == 'Callee' or key == 'DirectCallee':
value = cgi.escape(self.demangle(value)) value = html.escape(self.demangle(value))
if dl and key != 'Caller': if dl and key != 'Caller':
dl_dict = dict(list(dl)) dl_dict = dict(list(dl))