From 526c48a7f409722b129c69ccc9fb02189b3f673f Mon Sep 17 00:00:00 2001 From: Konstantinos Paliouras Date: Wed, 27 Sep 2017 13:05:40 +0300 Subject: [PATCH 1/4] Bump version to 0.9.4 --- flask_log_request_id/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_log_request_id/__init__.py b/flask_log_request_id/__init__.py index 23accbd..30b6c12 100644 --- a/flask_log_request_id/__init__.py +++ b/flask_log_request_id/__init__.py @@ -4,7 +4,7 @@ from . import parser -__version__ = '0.9.3' +__version__ = '0.9.4' __all__ = [ From 99d49b05b8b285fd6e4fe80bc211866b26a0bbb8 Mon Sep 17 00:00:00 2001 From: Konstantinos Paliouras Date: Thu, 31 Oct 2019 11:16:06 +0100 Subject: [PATCH 2/4] Add unit-test for bug fix 38 --- tests/request_id_tests.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/request_id_tests.py b/tests/request_id_tests.py index b1c0d5c..fc61a77 100644 --- a/tests/request_id_tests.py +++ b/tests/request_id_tests.py @@ -12,6 +12,14 @@ def setUp(self): self.app.route('/')(lambda: 'hello world') self.app.testing = True + def test_lazy_initialization(self): + # Bug #38: https://github.com/Workable/flask-log-request-id/issues/38 + request_id = RequestID() + request_id.init_app(self.app) + with self.app.test_request_context(headers={'X-Amzn-Trace-Id': 'Self=1-67891234-def;Root=1-67891233-abc'}): + self.app.preprocess_request() + self.assertEqual('1-67891234-def', current_request_id()) + def test_default_request_id_parser_with_amazon(self): RequestID(self.app) with self.app.test_request_context(headers={'X-Amzn-Trace-Id': 'Self=1-67891234-def;Root=1-67891233-abc'}): From 45c28d356ae1b169d7bf440a5cc1cc9868c49a7f Mon Sep 17 00:00:00 2001 From: Konstantinos Paliouras Date: Thu, 31 Oct 2019 11:34:47 +0100 Subject: [PATCH 3/4] Fix #38 crash on at init_app() --- flask_log_request_id/request_id.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_log_request_id/request_id.py b/flask_log_request_id/request_id.py index 695a61c..9f38ea0 100644 --- a/flask_log_request_id/request_id.py +++ b/flask_log_request_id/request_id.py @@ -81,7 +81,7 @@ def _persist_request_id(): setattr(g, g_object_attr, self._request_id_generator()) # Register after request - if self.app.config['LOG_REQUEST_ID_LOG_ALL_REQUESTS']: + if app.config['LOG_REQUEST_ID_LOG_ALL_REQUESTS']: app.after_request(self._log_http_event) @staticmethod From 97b24b8ab6f2bdc5a7d97acd866be2cd26305c6f Mon Sep 17 00:00:00 2001 From: Konstantinos Paliouras Date: Thu, 31 Oct 2019 15:31:42 +0100 Subject: [PATCH 4/4] Bump version to v0.10.2 --- flask_log_request_id/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_log_request_id/__init__.py b/flask_log_request_id/__init__.py index 99de142..6b365b3 100644 --- a/flask_log_request_id/__init__.py +++ b/flask_log_request_id/__init__.py @@ -4,7 +4,7 @@ from . import parser -__version__ = '0.0.0-dev' +__version__ = '0.10.2' __all__ = [