1
0

- Update to 1.1.1:

* Fixed `validate` `extra_validators` parameter. :pr:`548`
  * Drop support for Python 3.6.
  * ``validate_on_submit`` takes a ``extra_validators`` parameters :pr:`479`
  * Stop supporting Flask-Babelex :pr:`540`
  * Support for python 3.11 :pr:`542`
  * Remove unused call to `JSONEncoder` :pr:`536`
- Add patch flask-2.3-support.patch:
  * Support Flask 2.3 changes.
- Switch to pyproject macros.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:flask/python-Flask-WTF?expand=0&rev=14
This commit is contained in:
Steve Kowalik 2023-06-30 05:17:06 +00:00 committed by Git OBS Bridge
parent f3440add9c
commit b611c04334
5 changed files with 114 additions and 13 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34fe5c6fee0f69b50e30f81a3b7ea16aa1492a771fe9ad0974d164610c09a6c9
size 45721

3
Flask-WTF-1.1.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:41c4244e9ae626d63bed42ae4785b90667b885b1535d5a4095e1f63060d12aa9
size 52303

87
flask-2.3-support.patch Normal file
View File

@ -0,0 +1,87 @@
From 603318bfb31958572ff250fa29fc4e4678d438c8 Mon Sep 17 00:00:00 2001
From: Matt Shaw <matthew-shaw@users.noreply.github.com>
Date: Tue, 25 Apr 2023 22:07:52 +0100
Subject: [PATCH 1/2] fix #561
---
src/flask_wtf/recaptcha/widgets.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: Flask-WTF-1.1.1/src/flask_wtf/recaptcha/widgets.py
===================================================================
--- Flask-WTF-1.1.1.orig/src/flask_wtf/recaptcha/widgets.py
+++ Flask-WTF-1.1.1/src/flask_wtf/recaptcha/widgets.py
@@ -1,6 +1,7 @@
+from urllib.parse import urlencode
+
from flask import current_app
-from flask import Markup
-from werkzeug.urls import url_encode
+from markupsafe import Markup
RECAPTCHA_SCRIPT_DEFAULT = "https://www.google.com/recaptcha/api.js"
RECAPTCHA_DIV_CLASS_DEFAULT = "g-recaptcha"
@@ -22,7 +23,7 @@ class RecaptchaWidget:
if not script:
script = RECAPTCHA_SCRIPT_DEFAULT
if params:
- script += "?" + url_encode(params)
+ script += "?" + urlencode(params)
attrs = current_app.config.get("RECAPTCHA_DATA_ATTRS", {})
attrs["sitekey"] = public_key
snippet = " ".join(f'data-{k}="{attrs[k]}"' for k in attrs) # noqa: B028
Index: Flask-WTF-1.1.1/docs/changes.rst
===================================================================
--- Flask-WTF-1.1.1.orig/docs/changes.rst
+++ Flask-WTF-1.1.1/docs/changes.rst
@@ -1,6 +1,14 @@
Changes
=======
+Version 1.1.2
+-------------
+
+Unreleased
+
+- Fixed Flask 2.3 deprecations of ``werkzeug.urls.url_encode`` and
+ ``flask.Markup`` `:pr:`565` :issue:`561`
+
Version 1.1.1
-------------
Index: Flask-WTF-1.1.1/src/flask_wtf/recaptcha/validators.py
===================================================================
--- Flask-WTF-1.1.1.orig/src/flask_wtf/recaptcha/validators.py
+++ Flask-WTF-1.1.1/src/flask_wtf/recaptcha/validators.py
@@ -1,9 +1,9 @@
import json
from urllib import request as http
+from urllib.parse import urlencode
from flask import current_app
from flask import request
-from werkzeug.urls import url_encode
from wtforms import ValidationError
RECAPTCHA_VERIFY_SERVER_DEFAULT = "https://www.google.com/recaptcha/api/siteverify"
@@ -54,7 +54,7 @@ class Recaptcha:
if not verify_server:
verify_server = RECAPTCHA_VERIFY_SERVER_DEFAULT
- data = url_encode(
+ data = urlencode(
{"secret": private_key, "remoteip": remote_addr, "response": response}
)
Index: Flask-WTF-1.1.1/tests/test_recaptcha.py
===================================================================
--- Flask-WTF-1.1.1.orig/tests/test_recaptcha.py
+++ Flask-WTF-1.1.1/tests/test_recaptcha.py
@@ -80,7 +80,6 @@ def test_render_custom_args(app):
app.config["RECAPTCHA_DATA_ATTRS"] = {"red": "blue"}
f = RecaptchaForm()
render = f.recaptcha()
- # new versions of url_encode allow more characters
assert "?key=(value)" in render or "?key=%28value%29" in render
assert 'data-red="blue"' in render

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Fri Jun 30 05:16:29 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.1.1:
* Fixed `validate` `extra_validators` parameter. :pr:`548`
* Drop support for Python 3.6.
* ``validate_on_submit`` takes a ``extra_validators`` parameters :pr:`479`
* Stop supporting Flask-Babelex :pr:`540`
* Support for python 3.11 :pr:`542`
* Remove unused call to `JSONEncoder` :pr:`536`
- Add patch flask-2.3-support.patch:
* Support Flask 2.3 changes.
- Switch to pyproject macros.
-------------------------------------------------------------------
Sat Apr 9 02:30:54 UTC 2022 - Arun Persaud <arun@gmx.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-Flask-WTF
#
# 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
@ -16,19 +16,20 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%bcond_without test
Name: python-Flask-WTF
Version: 1.0.1
Version: 1.1.1
Release: 0
Summary: WTForms support for Flask
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/lepture/flask-wtf
Source: https://files.pythonhosted.org/packages/source/F/Flask-WTF/Flask-WTF-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#wtforms/flask-wtf#565
Patch0: flask-2.3-support.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Flask
@ -38,7 +39,6 @@ Requires: python-itsdangerous
Recommends: python-email_validator
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module Flask-BabelEx}
BuildRequires: %{python_module Flask-Babel}
BuildRequires: %{python_module Flask}
BuildRequires: %{python_module WTForms}
@ -52,13 +52,13 @@ BuildRequires: %{python_module pytest}
Adds WTForms support to your Flask application
%prep
%setup -q -n Flask-WTF-%{version}
%autosetup -p1 -n Flask-WTF-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%fdupes %{buildroot}%{_prefix}
%if %{with test}
@ -72,6 +72,6 @@ export LANG=en_US.UTF-8
%license LICENSE.rst
%doc README.rst
%{python_sitelib}/flask_wtf
%{python_sitelib}/Flask_WTF-%{version}-py*.egg-info
%{python_sitelib}/Flask_WTF-%{version}.dist-info
%changelog