From 3e3ee8b64162c62ed4ec80b7d449eb293c6f3433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sat, 15 Feb 2020 15:52:10 +0100 Subject: [PATCH] Fix compatibility with werkzeug 1.0.0. Fixes #611 (#614) --- .travis.yml | 2 -- isso/__init__.py | 6 +++--- isso/core.py | 3 ++- isso/dispatch.py | 2 +- isso/wsgi.py | 2 +- setup.py | 3 +-- tox.ini | 2 +- 7 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2ab65f..e0ed0fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ matrix: include: - python: 2.7 env: TOX_ENV=py27 - - python: 3.4 - env: TOX_ENV=py34 - python: 3.5 env: TOX_ENV=py35 - python: 3.6 diff --git a/isso/__init__.py b/isso/__init__.py index 6f783ce..90a4da8 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -57,11 +57,11 @@ from itsdangerous import URLSafeTimedSerializer from werkzeug.routing import Map from werkzeug.exceptions import HTTPException, InternalServerError -from werkzeug.wsgi import SharedDataMiddleware +from werkzeug.middleware.shared_data import SharedDataMiddleware from werkzeug.local import Local, LocalManager from werkzeug.serving import run_simple -from werkzeug.contrib.fixers import ProxyFix -from werkzeug.contrib.profiler import ProfilerMiddleware +from werkzeug.middleware.proxy_fix import ProxyFix +from werkzeug.middleware.profiler import ProfilerMiddleware local = Local() local_manager = LocalManager([local]) diff --git a/isso/core.py b/isso/core.py index 2395e13..0f0ce1a 100644 --- a/isso/core.py +++ b/isso/core.py @@ -19,7 +19,8 @@ if PY2K: else: import _thread as thread -from werkzeug.contrib.cache import NullCache, SimpleCache +from flask_caching.backends.null import NullCache +from flask_caching.backends.simple import SimpleCache logger = logging.getLogger("isso") diff --git a/isso/dispatch.py b/isso/dispatch.py index 7c8bb14..1c4e39a 100644 --- a/isso/dispatch.py +++ b/isso/dispatch.py @@ -8,7 +8,7 @@ import logging from glob import glob -from werkzeug.wsgi import DispatcherMiddleware +from werkzeug.middleware.dispatcher import DispatcherMiddleware from werkzeug.wrappers import Response from isso import dist, make_app, wsgi, config diff --git a/isso/wsgi.py b/isso/wsgi.py index c826289..90e20e7 100644 --- a/isso/wsgi.py +++ b/isso/wsgi.py @@ -146,7 +146,7 @@ class CORSMiddleware(object): if self.exposed: headers.add("Access-Control-Expose-Headers", ", ".join(self.exposed)) - return start_response(status, headers.to_list(), exc_info) + return start_response(status, headers.to_wsgi_list(), exc_info) if environ.get("REQUEST_METHOD") == "OPTIONS": add_cors_headers("200 Ok", [("Content-Type", "text/plain")]) diff --git a/setup.py b/setup.py index d2d171e..4e0c6b0 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import sys from setuptools import setup, find_packages requires = ['itsdangerous', 'Jinja2', 'misaka>=2.0,<3.0', 'html5lib', - 'werkzeug>=0.9', 'bleach'] + 'werkzeug>=1.0', 'bleach', 'flask-caching'] if sys.version_info < (2, 7): raise SystemExit("Python 2 versions < 2.7 are not supported.") @@ -31,7 +31,6 @@ setup( "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], diff --git a/tox.ini b/tox.ini index 4613cb3..5a168d1 100755 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py34,py35,py36,py37 +envlist = py27,py35,py36,py37 [testenv] deps =