From aad5e5847f48a8e65c63a7d94e8b688bfa24935b Mon Sep 17 00:00:00 2001 From: Christopher Wolfe Date: Wed, 18 Dec 2019 11:15:47 -0500 Subject: [PATCH 1/3] The HandlerMixin class's prepare() function checks if super().prepare() is an async coroutine instead of a Tornado future. --- sprockets/mixins/correlation/mixins.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sprockets/mixins/correlation/mixins.py b/sprockets/mixins/correlation/mixins.py index 7703ec6..0a6e3dd 100644 --- a/sprockets/mixins/correlation/mixins.py +++ b/sprockets/mixins/correlation/mixins.py @@ -1,6 +1,7 @@ +import asyncio import uuid -from tornado import concurrent, log +from tornado import log class HandlerMixin(object): @@ -45,9 +46,9 @@ class HandlerMixin(object): # Here we want to copy an incoming Correlation-ID header if # one exists. We also want to set it in the outgoing response # which the property setter does for us. - maybe_future = super(HandlerMixin, self).prepare() - if concurrent.is_future(maybe_future): - await maybe_future + maybe_coro = super(HandlerMixin, self).prepare() + if asyncio.iscoroutine(maybe_coro): + await maybe_coro correlation_id = self.get_request_header(self.__header_name, None) if correlation_id is not None: From 7e8af3e4befd21409fcaf2bf7ab37c93161e0442 Mon Sep 17 00:00:00 2001 From: Christopher Wolfe Date: Wed, 18 Dec 2019 11:20:44 -0500 Subject: [PATCH 2/3] Requires Tornado v5 or greater. --- requires/installation.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requires/installation.txt b/requires/installation.txt index 44d8d5a..616640f 100644 --- a/requires/installation.txt +++ b/requires/installation.txt @@ -1 +1 @@ -tornado>=4.3,<7 +tornado>=5,<7 From 695c5a70de234d934acb3fc2bc3a0f95058b61b8 Mon Sep 17 00:00:00 2001 From: Christopher Wolfe Date: Wed, 18 Dec 2019 11:27:26 -0500 Subject: [PATCH 3/3] Increased version to 3.0.0 --- HISTORY.rst | 6 ++++++ sprockets/mixins/correlation/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3182a21..8499c49 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,11 @@ Version History --------------- +`3.0.0`_ (18-Dec-2019) +~~~~~~~~~~~~~~~~~~~~~~ +- Dropped support for Tornado 4 +- Fixed support for async prepare in superclasses of ``HandlerMixin`` + `2.0.1`_ (18-Mar-2019) ~~~~~~~~~~~~~~~~~~~~~~ - Add support for Tornado 6 @@ -21,6 +26,7 @@ Version History ~~~~~~~~~~~~~~~~~~~~~~ - Adds ``sprockets.mixins.correlation.HandlerMixin`` +.. _`3.0.0`: https://github.com/sprockets/sprockets.mixins.correlation/compare/3.0.0...2.0.1 .. _`2.0.1`: https://github.com/sprockets/sprockets.mixins.correlation/compare/2.0.0...2.0.1 .. _`2.0.0`: https://github.com/sprockets/sprockets.mixins.correlation/compare/1.0.2...2.0.0 .. _`1.0.2`: https://github.com/sprockets/sprockets.mixins.correlation/compare/1.0.1...1.0.2 diff --git a/sprockets/mixins/correlation/__init__.py b/sprockets/mixins/correlation/__init__.py index ff54cb0..a42ead9 100644 --- a/sprockets/mixins/correlation/__init__.py +++ b/sprockets/mixins/correlation/__init__.py @@ -7,5 +7,5 @@ except ImportError: raise ImportError -version_info = (2, 0, 1) +version_info = (3, 0, 0) __version__ = '.'.join(str(v) for v in version_info[:3])