From d9c0d4e3178661123c8ded1c053fde8bf80f2897 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Fri, 30 Aug 2019 10:59:12 +0200 Subject: [PATCH 1/2] Extend tox and travis config with a newer Pythons --- .travis.yml | 4 ++++ tox.ini | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6ca13cb..0d819ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,10 @@ env: - TOX_ENV=py32 - TOX_ENV=py33 - TOX_ENV=py34 + - TOX_ENV=py35 + - TOX_ENV=py36 + - TOX_ENV=py37 + - TOX_ENV=py38 install: - pip install tox diff --git a/tox.ini b/tox.ini index 5e94c62..86c5368 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,4 @@ [tox] -envlist = py27, pypy, py32, py33, py34 +envlist = py27, pypy, py32, py33, py34, py35, py36, py37, py38 [testenv] commands=python setup.py test From ee69d45f1a7f928f7b241702e9be06007444115e Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Fri, 30 Aug 2019 10:59:43 +0200 Subject: [PATCH 2/2] Use `html` module in Python 3 and cgi module in Python 2 `cgi.escape()` has been deprecated since Python 3.2 and removed from Python 3.8. Fixes: https://github.com/Cue/scales/issues/46 --- src/greplin/scales/formats.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/greplin/scales/formats.py b/src/greplin/scales/formats.py index c4ef979..b6a96d4 100644 --- a/src/greplin/scales/formats.py +++ b/src/greplin/scales/formats.py @@ -16,7 +16,11 @@ from greplin import scales -import cgi +try: + import html +except ImportError: + # Python 2.7 has no html module + import cgi as html import six import json import operator @@ -105,7 +109,7 @@ def _htmlRenderDict(pathParts, statDict, output): output.write('
') for key in keys: - keyStr = cgi.escape(_utf8str(key)) + keyStr = html.escape(_utf8str(key)) value = statDict[key] if hasattr(value, '__call__'): value = value() @@ -119,7 +123,7 @@ def _htmlRenderDict(pathParts, statDict, output): _htmlRenderDict(valuePath, value, output) else: output.write('
%s %s
' % - (keyStr, type(value).__name__, cgi.escape(_utf8str(value)).replace('\n', '
'))) + (keyStr, type(value).__name__, html.escape(_utf8str(value)).replace('\n', '
'))) if links: for link in links: