Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-Flask-Admin for 
openSUSE:Factory checked in at 2023-10-26 17:14:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Flask-Admin (Old)
 and      /work/SRC/openSUSE:Factory/.python-Flask-Admin.new.24901 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-Flask-Admin"

Thu Oct 26 17:14:49 2023 rev:16 rq:1120478 version:1.6.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Flask-Admin/python-Flask-Admin.changes    
2023-07-10 16:39:48.334508842 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-Flask-Admin.new.24901/python-Flask-Admin.changes
 2023-10-26 17:15:54.975568269 +0200
@@ -1,0 +2,8 @@
+Tue Oct 24 12:14:40 UTC 2023 - Markéta Machová <mmach...@suse.com>
+
+- Add few patches to fix tests (from gh#flask-admin/flask-admin#2328):
+  * model-from-model.patch
+  * reverse-relation-for-model.patch
+  * bytes-not-str.patch
+
+-------------------------------------------------------------------

New:
----
  bytes-not-str.patch
  model-from-model.patch
  reverse-relation-for-model.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-Flask-Admin.spec ++++++
--- /var/tmp/diff_new_pack.9oJNGz/_old  2023-10-26 17:15:55.471586485 +0200
+++ /var/tmp/diff_new_pack.9oJNGz/_new  2023-10-26 17:15:55.471586485 +0200
@@ -26,13 +26,17 @@
 # PATCH-FIX-OPENSUSE Flask-BabelEx has been firmly deprecated, switch to Babel
 # directly.
 Patch0:         switch-to-babel.patch
+# cherry-picks from https://github.com/flask-admin/flask-admin/pull/2328 
Support latest flask, sqlalchemy, flask-sqlalchemy and wtforms
+Patch1:         model-from-model.patch
+Patch2:         reverse-relation-for-model.patch
+Patch3:         bytes-not-str.patch
 BuildRequires:  %{python_module Flask >= 0.7}
 BuildRequires:  %{python_module Flask-Babel}
 BuildRequires:  %{python_module Flask-SQLAlchemy}
 BuildRequires:  %{python_module Pillow >= 3.3.2}
 BuildRequires:  %{python_module PyYAML}
-BuildRequires:  %{python_module SQLAlchemy < 2.0}
 BuildRequires:  %{python_module SQLAlchemy-Utils}
+BuildRequires:  %{python_module SQLAlchemy}
 BuildRequires:  %{python_module WTForms}
 BuildRequires:  %{python_module arrow}
 BuildRequires:  %{python_module colour}
@@ -45,7 +49,7 @@
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-Flask >= 0.7
-Requires:       python-SQLAlchemy < 2.0
+Requires:       python-SQLAlchemy
 Requires:       python-WTForms
 BuildArch:      noarch
 %python_subpackages

++++++ bytes-not-str.patch ++++++
>From 11b657cd886f18ad186eb8cf5401b00bcba0f842 Mon Sep 17 00:00:00 2001
From: Chris Mayo <aklh...@gmail.com>
Date: Mon, 23 Oct 2023 19:22:07 +0100
Subject: [PATCH] Fix test_file_admin: "a bytes-like object is required, not
 'str'"

---
 flask_admin/tests/fileadmin/test_fileadmin.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: Flask-Admin-1.6.1/flask_admin/tests/fileadmin/test_fileadmin.py
===================================================================
--- Flask-Admin-1.6.1.orig/flask_admin/tests/fileadmin/test_fileadmin.py
+++ Flask-Admin-1.6.1/flask_admin/tests/fileadmin/test_fileadmin.py
@@ -1,3 +1,4 @@
+from io import BytesIO
 import os
 import os.path as op
 import unittest
@@ -80,7 +81,7 @@ class Base:
             assert rv.status_code == 200
 
             rv = client.post('/admin/myfileadmin/upload/',
-                             data=dict(upload=(StringIO(""), 'dummy.txt')))
+                             data=dict(upload=(BytesIO("".encode("utf8")), 
'dummy.txt')))
             assert rv.status_code == 302
 
             rv = client.get('/admin/myfileadmin/')

++++++ model-from-model.patch ++++++
>From d18b41fa9ff98cc2ebf0c282c8ad096299924d89 Mon Sep 17 00:00:00 2001
From: David Gilman <davidgilm...@gmail.com>
Date: Mon, 23 Oct 2023 19:22:07 +0100
Subject: [PATCH] Resolve test_multi_pk.py Flask-SQLAlchemy Model
 DeprecationWarning

---
 flask_admin/tests/sqla/test_multi_pk.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/flask_admin/tests/sqla/test_multi_pk.py 
b/flask_admin/tests/sqla/test_multi_pk.py
index dd122baee..d73625cc7 100644
--- a/flask_admin/tests/sqla/test_multi_pk.py
+++ b/flask_admin/tests/sqla/test_multi_pk.py
@@ -1,7 +1,11 @@
 from . import setup
 from .test_basic import CustomModelView
 
-from flask_sqlalchemy import Model
+try:
+    # Flask-SQLAlchemy 3
+    from flask_sqlalchemy.model import Model
+except ImportError:
+    from flask_sqlalchemy import Model
 from sqlalchemy.ext.declarative import declarative_base
 
 

++++++ reverse-relation-for-model.patch ++++++
>From 84139973c90aa43e00267d294fd9dcd7d3aa4d2d Mon Sep 17 00:00:00 2001
From: Chris Mayo <aklh...@gmail.com>
Date: Mon, 23 Oct 2023 19:22:07 +0100
Subject: [PATCH] Fix Exception: Cannot find reverse relation for model

SQLAlchemy 2.0.2 removed the invocation of registry.configure() from
Mapper.iterate_properties causing this problem.

sqlalchemy.orm.registry.configure() was added in 1.4.0b2.

Observed as test failures in:

flask_admin/tests/sqla/test_basic.py
flask_admin/tests/sqla/test_form_rules.py
flask_admin/tests/sqla/test_inlineform.py
---
 flask_admin/contrib/sqla/form.py | 1 +
 flask_admin/contrib/sqla/view.py | 1 +
 2 files changed, 2 insertions(+)

Index: Flask-Admin-1.6.1/flask_admin/contrib/sqla/form.py
===================================================================
--- Flask-Admin-1.6.1.orig/flask_admin/contrib/sqla/form.py
+++ Flask-Admin-1.6.1/flask_admin/contrib/sqla/form.py
@@ -668,6 +668,7 @@ class InlineModelConverter(InlineModelCo
         target_mapper = info.model._sa_class_manager.mapper.base_mapper
 
         reverse_prop = None
+        model.registry.configure()
 
         for prop in target_mapper.iterate_properties:
             if hasattr(prop, 'direction') and prop.direction.name in 
('MANYTOONE', 'MANYTOMANY'):
Index: Flask-Admin-1.6.1/flask_admin/contrib/sqla/view.py
===================================================================
--- Flask-Admin-1.6.1.orig/flask_admin/contrib/sqla/view.py
+++ Flask-Admin-1.6.1/flask_admin/contrib/sqla/view.py
@@ -366,6 +366,7 @@ class ModelView(BaseModelView):
         if model is None:
             model = self.model
 
+        model.registry.configure()
         return model._sa_class_manager.mapper.iterate_properties
 
     def _apply_path_joins(self, query, joins, path, inner_join=True):

Reply via email to