-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update python-Flask-Admin to version 1.6.1 / rev 16 via SR 1120478
https://build.opensuse.org/request/show/1120478 by user mcalabkova + anag+factory - Add few patches to fix tests (from gh#pallets-eco/flask-admin#2328): * model-from-model.patch * reverse-relation-for-model.patch * bytes-not-str.patch
- Loading branch information
1 parent
161710c
commit f44afe5
Showing
7 changed files
with
125 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From 11b657cd886f18ad186eb8cf5401b00bcba0f842 Mon Sep 17 00:00:00 2001 | ||
From: Chris Mayo <[email protected]> | ||
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/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From d18b41fa9ff98cc2ebf0c282c8ad096299924d89 Mon Sep 17 00:00:00 2001 | ||
From: David Gilman <[email protected]> | ||
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
------------------------------------------------------------------- | ||
Tue Oct 24 12:14:40 UTC 2023 - Markéta Machová <[email protected]> | ||
|
||
- 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 | ||
|
||
------------------------------------------------------------------- | ||
Mon Jul 10 02:12:28 UTC 2023 - Steve Kowalik <[email protected]> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/p/python-Flask-Admin/reverse-relation-for-model.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 84139973c90aa43e00267d294fd9dcd7d3aa4d2d Mon Sep 17 00:00:00 2001 | ||
From: Chris Mayo <[email protected]> | ||
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): |