- Add patch switch-to-babel.patch:
* Use Flask-Babel, rather than Flask-BabelEx. - Skip a recalcitrant test. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:flask/python-Flask-Admin?expand=0&rev=31
This commit is contained in:
parent
e87dbad784
commit
d61acd4f1e
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 10 02:12:28 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch switch-to-babel.patch:
|
||||
* Use Flask-Babel, rather than Flask-BabelEx.
|
||||
- Skip a recalcitrant test.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 19 01:49:58 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#
|
||||
|
||||
|
||||
%define skip_python2 1
|
||||
Name: python-Flask-Admin
|
||||
Version: 1.6.1
|
||||
Release: 0
|
||||
@ -24,8 +23,11 @@ Summary: Extensible admin interface framework for Flask
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/flask-admin/flask-admin/
|
||||
Source: https://files.pythonhosted.org/packages/source/F/Flask-Admin/Flask-Admin-%{version}.tar.gz
|
||||
# PATCH-FIX-OPENSUSE Flask-BabelEx has been firmly deprecated, switch to Babel
|
||||
# directly.
|
||||
Patch0: switch-to-babel.patch
|
||||
BuildRequires: %{python_module Flask >= 0.7}
|
||||
BuildRequires: %{python_module Flask-BabelEx}
|
||||
BuildRequires: %{python_module Flask-Babel}
|
||||
BuildRequires: %{python_module Flask-SQLAlchemy}
|
||||
BuildRequires: %{python_module Pillow >= 3.3.2}
|
||||
BuildRequires: %{python_module PyYAML}
|
||||
@ -75,7 +77,7 @@ rm -f flask_admin/tests/test_form_upload.py
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pytest -k 'not test_model and not test_inline_form_base_class'
|
||||
%pytest -k 'not test_model and not test_inline_form_base_class and not test_safe_redirect'
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
|
56
switch-to-babel.patch
Normal file
56
switch-to-babel.patch
Normal file
@ -0,0 +1,56 @@
|
||||
Index: Flask-Admin-1.6.1/flask_admin/tests/sqla/test_basic.py
|
||||
===================================================================
|
||||
--- Flask-Admin-1.6.1.orig/flask_admin/tests/sqla/test_basic.py
|
||||
+++ Flask-Admin-1.6.1/flask_admin/tests/sqla/test_basic.py
|
||||
@@ -7,7 +7,7 @@ from flask_admin.form.fields import Sele
|
||||
from flask_admin._compat import as_unicode
|
||||
from flask_admin._compat import iteritems
|
||||
from flask_admin.contrib.sqla import ModelView, filters, tools
|
||||
-from flask_babelex import Babel
|
||||
+from flask_babel import Babel
|
||||
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
from sqlalchemy import cast
|
||||
Index: Flask-Admin-1.6.1/flask_admin/tests/sqla/test_translation.py
|
||||
===================================================================
|
||||
--- Flask-Admin-1.6.1.orig/flask_admin/tests/sqla/test_translation.py
|
||||
+++ Flask-Admin-1.6.1/flask_admin/tests/sqla/test_translation.py
|
||||
@@ -1,5 +1,5 @@
|
||||
from flask_admin.babel import lazy_gettext
|
||||
-from flask_babelex import Babel
|
||||
+from flask_babel import Babel
|
||||
|
||||
from . import setup
|
||||
from .test_basic import CustomModelView, create_models
|
||||
Index: Flask-Admin-1.6.1/flask_admin/babel.py
|
||||
===================================================================
|
||||
--- Flask-Admin-1.6.1.orig/flask_admin/babel.py
|
||||
+++ Flask-Admin-1.6.1/flask_admin/babel.py
|
||||
@@ -1,8 +1,5 @@
|
||||
try:
|
||||
- try:
|
||||
- from flask_babelex import Domain
|
||||
- except ImportError:
|
||||
- from flask_babel import Domain
|
||||
+ from flask_babel import Domain
|
||||
|
||||
except ImportError:
|
||||
def gettext(string, **variables):
|
||||
Index: Flask-Admin-1.6.1/flask_admin/base.py
|
||||
===================================================================
|
||||
--- Flask-Admin-1.6.1.orig/flask_admin/base.py
|
||||
+++ Flask-Admin-1.6.1/flask_admin/base.py
|
||||
@@ -524,6 +524,13 @@ class Admin(object):
|
||||
# Add index view
|
||||
self._set_admin_index_view(index_view=index_view, endpoint=endpoint, url=url)
|
||||
|
||||
+ # Initialise Babel, if we have it
|
||||
+ try:
|
||||
+ from flask_babel import Babel
|
||||
+ Babel(app)
|
||||
+ except ImportError:
|
||||
+ pass
|
||||
+
|
||||
# Register with application
|
||||
if app is not None:
|
||||
self._init_extension()
|
Loading…
x
Reference in New Issue
Block a user