Skip to content

Commit

Permalink
Fix test failures on Python 3.8.0a1 (#15)
Browse files Browse the repository at this point in the history
* Avoid the deprecated cgi.escape

Fixes test failures on Python 3.8 prereleases (where cgi.escape is not
just deprecated, but gone entirely).
  • Loading branch information
mgedmin authored and Michael Howitz committed Mar 21, 2019
1 parent bdf8846 commit 4607802
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: python
sudo: false
python:
- 2.7
- 3.4
Expand All @@ -11,7 +10,8 @@ matrix:
include:
- python: "3.7"
dist: xenial
sudo: true
- python: "3.8-dev"
dist: xenial
install:
- pip install -U pip setuptools
- pip install -U coverage coveralls
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
4.4 (unreleased)
================

- Nothing changed yet.
- Fix test failures and deprecation warnings occurring when using Python 3.8a1.
(`#15 <https://github.com/zopefoundation/zope.tales/pull/15>`_)


4.3 (2018-10-05)
Expand Down
6 changes: 5 additions & 1 deletion src/zope/tales/tales.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
__docformat__ = "reStructuredText"
import re

try:
from html import escape
except ImportError:
from cgi import escape

from zope.interface import implementer
from zope.interface import Interface
import six
Expand Down Expand Up @@ -822,5 +827,4 @@ def getInfo(self, as_html=0):
if not as_html:
return ' - Names:\n %s' % s.replace('\n', '\n ')

from cgi import escape
return '<b>Names:</b><pre>%s</pre>' % (escape(s))
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py27,py34,py35,py36,py37,pypy,pypy3,coverage,docs
py27,py34,py35,py36,py37,py38,pypy,pypy3,coverage,docs

[testenv]
commands =
Expand Down

0 comments on commit 4607802

Please sign in to comment.