X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bcf069c6a726e219bc40224653268d87776e54aa..040c1afc709ae32d5cedd2f0a3815a12b1909bf3:/tools/crunchstat-summary/crunchstat_summary/webchart.py diff --git a/tools/crunchstat-summary/crunchstat_summary/webchart.py b/tools/crunchstat-summary/crunchstat_summary/webchart.py index 9d18883ce2..cf0c1e67aa 100644 --- a/tools/crunchstat-summary/crunchstat_summary/webchart.py +++ b/tools/crunchstat-summary/crunchstat_summary/webchart.py @@ -2,7 +2,11 @@ # # SPDX-License-Identifier: AGPL-3.0 -import cgi +try: + from html import escape +except ImportError: + from cgi import escape + import json import pkg_resources @@ -27,13 +31,13 @@ class WebChart(object): {} - '''.format(cgi.escape(self.label), + '''.format(escape(self.label), self.JSLIB, self.js(), self.headHTML()) def js(self): return 'var chartdata = {};\n{}'.format( json.dumps(self.sections()), - '\n'.join([pkg_resources.resource_string('crunchstat_summary', jsa) for jsa in self.JSASSETS])) + '\n'.join([pkg_resources.resource_string('crunchstat_summary', jsa).decode('utf-8') for jsa in self.JSASSETS])) def sections(self): return [