Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py38 compatibility #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/greplin/scales/formats.py
Expand Up @@ -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
Expand Down Expand Up @@ -105,7 +109,7 @@ def _htmlRenderDict(pathParts, statDict, output):

output.write('<div class="level">')
for key in keys:
keyStr = cgi.escape(_utf8str(key))
keyStr = html.escape(_utf8str(key))
value = statDict[key]
if hasattr(value, '__call__'):
value = value()
Expand All @@ -119,7 +123,7 @@ def _htmlRenderDict(pathParts, statDict, output):
_htmlRenderDict(valuePath, value, output)
else:
output.write('<div><span class="key">%s</span> <span class="%s">%s</span></div>' %
(keyStr, type(value).__name__, cgi.escape(_utf8str(value)).replace('\n', '<br/>')))
(keyStr, type(value).__name__, html.escape(_utf8str(value)).replace('\n', '<br/>')))

if links:
for link in links:
Expand Down
2 changes: 1 addition & 1 deletion 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