diff --git a/python-Flask-Security-Too.changes b/python-Flask-Security-Too.changes index 5143bc2..d532359 100644 --- a/python-Flask-Security-Too.changes +++ b/python-Flask-Security-Too.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 6 03:54:08 UTC 2023 - Steve Kowalik + +- Add patch support-Flask-SQLAlchemy-3.0.patch: + * Support Flask-SQLAlchemy >= 3.0 + ------------------------------------------------------------------- Fri Sep 30 06:52:16 UTC 2022 - Steve Kowalik diff --git a/python-Flask-Security-Too.spec b/python-Flask-Security-Too.spec index d0d7862..d8636a8 100644 --- a/python-Flask-Security-Too.spec +++ b/python-Flask-Security-Too.spec @@ -1,7 +1,7 @@ # # spec file for package python-Flask-Security-Too # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,7 +26,10 @@ License: MIT URL: https://github.com/Flask-Middleware/flask-security Source: https://files.pythonhosted.org/packages/source/F/Flask-Security-Too/Flask-Security-Too-%{version}.tar.gz Patch0: no-mongodb.patch +# PATCH-FIX-OPENSUSE Use pyqrcodeng, we do not ship qrcode in OpenSUSE. Patch1: use-pyqrcodeng.patch +# PATCH-FIX-UPSTREAM gh#Flask-Middleware/flask-security#9632a0eab5d3be4280c185e7e934a57fc24057a2 +Patch2: support-Flask-SQLAlchemy-3.0.patch BuildRequires: %{python_module Babel >= 2.9.1} BuildRequires: %{python_module Flask >= 1.1.1} BuildRequires: %{python_module Flask-Babel >= 2.0.0} diff --git a/support-Flask-SQLAlchemy-3.0.patch b/support-Flask-SQLAlchemy-3.0.patch new file mode 100644 index 0000000..859ef43 --- /dev/null +++ b/support-Flask-SQLAlchemy-3.0.patch @@ -0,0 +1,50 @@ +From 9632a0eab5d3be4280c185e7e934a57fc24057a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=BCrg=20Rast?= +Date: Mon, 26 Sep 2022 16:35:31 +0200 +Subject: [PATCH] Fixed issues related to upcomming flask-sqlalchemy 3.0.0 + release (#678) + +- rename of get_debug_queries to get_recorded_queries (and move to to new module) +- SQLALCHEMY_RECORD_QUERIES must be set explicit +--- + tests/conftest.py | 4 ++++ + tests/test_utils.py | 11 ++++++++--- + 2 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index b9076413..f5e41a43 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -410,6 +410,10 @@ def sqlalchemy_setup(request, app, tmpdir, realdburl): + else: + app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:" + ++ # In Flask-SQLAlchemy >= 3.0.0 queries are no longer logged automatically, ++ # even in debug or testing mode. ++ app.config["SQLALCHEMY_RECORD_QUERIES"] = True ++ + db = SQLAlchemy(app) + + fsqla.FsModels.set_db_info(db) +diff --git a/tests/test_utils.py b/tests/test_utils.py +index df569a74..5c63dc55 100644 +--- a/tests/test_utils.py ++++ b/tests/test_utils.py +@@ -201,9 +201,14 @@ def get_num_queries(datastore): + return None if datastore doesn't support this. + """ + if is_sqlalchemy(datastore): +- from flask_sqlalchemy import get_debug_queries +- +- return len(get_debug_queries()) ++ try: ++ # Flask-SQLAlachemy >= 3.0.0 ++ from flask_sqlalchemy.record_queries import get_recorded_queries ++ except ImportError: ++ # Flask-SQLAlchemy < 3.0.0 ++ from flask_sqlalchemy import get_debug_queries as get_recorded_queries ++ ++ return len(get_recorded_queries()) + return None + +