From fce2006eeef2528e9b59ce9097ff215e6117d787 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Wed, 5 Dec 2018 14:52:57 +0000 Subject: [PATCH] fix backwards compatible problems with python-engineio 3.0 --- socketio/middleware.py | 4 ++++ socketio/tornado.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/socketio/middleware.py b/socketio/middleware.py index aa1b33b..252c65f 100644 --- a/socketio/middleware.py +++ b/socketio/middleware.py @@ -39,3 +39,7 @@ class WSGIApp(engineio.WSGIApp): class Middleware(WSGIApp): """This class has been renamed to WSGIApp and is now deprecated.""" + def __init__(self, socketio_app, wsgi_app=None, + socketio_path='socket.io'): + super(Middleware, self).__init__(socketio_app, wsgi_app, + socketio_path=socketio_path) diff --git a/socketio/tornado.py b/socketio/tornado.py index 007c492..10a4d4d 100644 --- a/socketio/tornado.py +++ b/socketio/tornado.py @@ -1,7 +1,11 @@ import sys if sys.version_info >= (3, 5): - from engineio.async_tornado import get_tornado_handler as \ - get_engineio_handler + try: + from engineio.async_drivers.tornado import get_tornado_handler as \ + get_engineio_handler + except ImportError: + from engineio.async_tornado import get_tornado_handler as \ + get_engineio_handler def get_tornado_handler(socketio_server):