diff options
author | Marius Gedminas <marius@gedmin.as> | 2019-03-21 09:26:27 +0200 |
---|---|---|
committer | Michael Howitz <mh@gocept.com> | 2019-03-21 08:26:27 +0100 |
commit | 460780200685ab56f030e0ff459a36be1dbbb72f (patch) | |
tree | 16d0ea70dddb6b14f9a51659404d2b6d833fe253 | |
parent | bdf884643713a2d2f3686f5667d4e8920a548ede (diff) | |
download | zope-tales-460780200685ab56f030e0ff459a36be1dbbb72f.tar.gz |
Fix test failures on Python 3.8.0a1 (#15)
* Avoid the deprecated cgi.escape
Fixes test failures on Python 3.8 prereleases (where cgi.escape is not
just deprecated, but gone entirely).
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | CHANGES.rst | 3 | ||||
-rw-r--r-- | src/zope/tales/tales.py | 6 | ||||
-rw-r--r-- | tox.ini | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index 80e6fd7..1984782 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: python -sudo: false python: - 2.7 - 3.4 @@ -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 diff --git a/CHANGES.rst b/CHANGES.rst index bb36cbb..78064d6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) diff --git a/src/zope/tales/tales.py b/src/zope/tales/tales.py index 9765fc8..0cb5ce2 100644 --- a/src/zope/tales/tales.py +++ b/src/zope/tales/tales.py @@ -18,6 +18,11 @@ An implementation of a TAL expression engine __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 @@ -822,5 +827,4 @@ class TALESTracebackSupplement(object): 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)) @@ -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 = |