- Add patch support-Flask-SQLAlchemy-3.0.patch:
* Support Flask-SQLAlchemy >= 3.0 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:flask/python-Flask-Security-Too?expand=0&rev=25
This commit is contained in:
parent
ae8071c5bc
commit
7a1b702abb
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 6 03:54:08 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch support-Flask-SQLAlchemy-3.0.patch:
|
||||
* Support Flask-SQLAlchemy >= 3.0
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Sep 30 06:52:16 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
@ -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}
|
||||
|
50
support-Flask-SQLAlchemy-3.0.patch
Normal file
50
support-Flask-SQLAlchemy-3.0.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 9632a0eab5d3be4280c185e7e934a57fc24057a2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?J=C3=BCrg=20Rast?= <juergr@gmail.com>
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user