Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-Flask-WTF for
openSUSE:Factory checked in at 2021-08-18 08:55:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Flask-WTF (Old)
and /work/SRC/openSUSE:Factory/.python-Flask-WTF.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Flask-WTF"
Wed Aug 18 08:55:50 2021 rev:9 rq:912377 version:0.15.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Flask-WTF/python-Flask-WTF.changes
2021-06-01 10:41:44.541250316 +0200
+++
/work/SRC/openSUSE:Factory/.python-Flask-WTF.new.1899/python-Flask-WTF.changes
2021-08-18 08:56:36.842925371 +0200
@@ -1,0 +2,20 @@
+Sat Aug 14 11:30:16 UTC 2021 - Fusion Future <[email protected]>
+
+- Update to 0.15.1
+ * Add python_requires metadata to avoid installing on unsupported
+ Python versions.
+- Changes from 0.15.0
+ * Drop support for Python < 3.6.
+ * FileSize validator.
+ * Extra requirement email installs the email_validator package.
+ * Fixed Flask 2.0 warnings.
+ * Various documentation fixes.
+ * Various CI fixes.
+- Add fix-ModuleNotFoundError-wtforms-compat.patch to fix
+ ModuleNotFoundError in tests/test_form.py.
+- Add fix-ModuleNotFoundError-wtforms-widgets-html5.patch to fix
+ ModuleNotFoundError in flask_wtf/html5.py.
+- Skip test_set_default_message_language and test_i18n because of
+ gh#wtforms/wtforms#697.
+
+-------------------------------------------------------------------
Old:
----
Flask-WTF-0.14.3.tar.gz
New:
----
Flask-WTF-0.15.1.tar.gz
fix-ModuleNotFoundError-wtforms-compat.patch
fix-ModuleNotFoundError-wtforms-widgets-html5.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-Flask-WTF.spec ++++++
--- /var/tmp/diff_new_pack.yh77So/_old 2021-08-18 08:56:37.350924773 +0200
+++ /var/tmp/diff_new_pack.yh77So/_new 2021-08-18 08:56:37.350924773 +0200
@@ -20,13 +20,17 @@
%define skip_python2 1
%bcond_without test
Name: python-Flask-WTF
-Version: 0.14.3
+Version: 0.15.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-OPENSUSE fix-ModuleNotFoundError-wtforms-compat.patch
https://github.com/wtforms/wtforms/commit/a34eb532d3b96ed216f204ed3d22fc9962241446
+Patch0: fix-ModuleNotFoundError-wtforms-compat.patch
+# PATCH-FIX-OPENSUSE fix-ModuleNotFoundError-wtforms-widgets-html5.patch
https://github.com/wtforms/wtforms/commit/44a1cecc071cfaec4ff60c9e28935d136cc232ca
+Patch1: fix-ModuleNotFoundError-wtforms-widgets-html5.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -34,6 +38,7 @@
Requires: python-WTForms
Requires: python-Werkzeug
Requires: python-itsdangerous
+Recommends: python-email_validator
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module Flask-BabelEx}
@@ -51,6 +56,8 @@
%prep
%setup -q -n Flask-WTF-%{version}
+%patch0 -p1
+%patch1 -p1
%build
%python_build
@@ -62,7 +69,8 @@
%if %{with test}
%check
export LANG=en_US.UTF-8
-%pytest tests
+# Excluded tests because of gh#wtforms/wtforms#697
+%pytest -k 'not (test_set_default_message_language or test_i18n)' tests
%endif
%files %{python_files}
++++++ Flask-WTF-0.14.3.tar.gz -> Flask-WTF-0.15.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/Flask_WTF.egg-info/PKG-INFO
new/Flask-WTF-0.15.1/Flask_WTF.egg-info/PKG-INFO
--- old/Flask-WTF-0.14.3/Flask_WTF.egg-info/PKG-INFO 2020-02-07
00:18:02.000000000 +0100
+++ new/Flask-WTF-0.15.1/Flask_WTF.egg-info/PKG-INFO 2021-05-25
20:01:47.000000000 +0200
@@ -1,32 +1,13 @@
Metadata-Version: 2.1
Name: Flask-WTF
-Version: 0.14.3
+Version: 0.15.1
Summary: Simple integration of Flask and WTForms.
-Home-page: https://github.com/lepture/flask-wtf
+Home-page: https://github.com/wtforms/flask-wtf
Author: Dan Jacob
Author-email: [email protected]
Maintainer: Hsiaoming Yang
Maintainer-email: [email protected]
License: BSD
-Description: Flask-WTF
- =========
-
- .. image:: https://travis-ci.org/lepture/flask-wtf.svg?branch=master
- :target: https://travis-ci.org/lepture/flask-wtf
- :alt: Test Status
- .. image::
https://codecov.io/gh/lepture/flask-wtf/branch/master/graph/badge.svg
- :target: https://codecov.io/gh/lepture/flask-wtf
- :alt: Coverage Status
-
- Simple integration of Flask and WTForms, including CSRF, file upload,
and reCAPTCHA.
-
- Links
- -----
-
- * `Documentation <https://flask-wtf.readthedocs.io>`_
- * `PyPI <https://pypi.python.org/pypi/Flask-WTF>`_
- * `GitHub <https://github.com/lepture/flask-wtf>`_
-
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
@@ -35,16 +16,40 @@
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >= 3.6
Description-Content-Type: text/x-rst
+Provides-Extra: email
+License-File: LICENSE
+
+Flask-WTF
+=========
+
+.. image::
https://github.com/wtforms/flask-wtf/actions/workflows/tests.yaml/badge.svg
+ :target: https://github.com/wtforms/flask-wtf/actions/
+ :alt: Test Status
+.. image::
https://codecov.io/gh/wtforms/flask-wtf/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/wtforms/flask-wtf
+ :alt: Coverage Status
+.. image:: https://readthedocs.org/projects/flask-wtf/badge/?version=latest
+ :target: https://flask-wtf.readthedocs.io/
+ :alt: Documentation
+
+Simple integration of Flask and WTForms, including CSRF, file upload, and
reCAPTCHA.
+
+Links
+-----
+
+* `Documentation <https://flask-wtf.readthedocs.io>`_
+* `PyPI <https://pypi.python.org/pypi/Flask-WTF>`_
+* `GitHub <https://github.com/wtforms/flask-wtf>`_
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/Flask_WTF.egg-info/requires.txt
new/Flask-WTF-0.15.1/Flask_WTF.egg-info/requires.txt
--- old/Flask-WTF-0.14.3/Flask_WTF.egg-info/requires.txt 2020-02-07
00:18:02.000000000 +0100
+++ new/Flask-WTF-0.15.1/Flask_WTF.egg-info/requires.txt 2021-05-25
20:01:47.000000000 +0200
@@ -1,3 +1,6 @@
Flask
WTForms
itsdangerous
+
+[email]
+email-validator
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/PKG-INFO
new/Flask-WTF-0.15.1/PKG-INFO
--- old/Flask-WTF-0.14.3/PKG-INFO 2020-02-07 00:18:03.016854300 +0100
+++ new/Flask-WTF-0.15.1/PKG-INFO 2021-05-25 20:01:47.330057400 +0200
@@ -1,32 +1,13 @@
Metadata-Version: 2.1
Name: Flask-WTF
-Version: 0.14.3
+Version: 0.15.1
Summary: Simple integration of Flask and WTForms.
-Home-page: https://github.com/lepture/flask-wtf
+Home-page: https://github.com/wtforms/flask-wtf
Author: Dan Jacob
Author-email: [email protected]
Maintainer: Hsiaoming Yang
Maintainer-email: [email protected]
License: BSD
-Description: Flask-WTF
- =========
-
- .. image:: https://travis-ci.org/lepture/flask-wtf.svg?branch=master
- :target: https://travis-ci.org/lepture/flask-wtf
- :alt: Test Status
- .. image::
https://codecov.io/gh/lepture/flask-wtf/branch/master/graph/badge.svg
- :target: https://codecov.io/gh/lepture/flask-wtf
- :alt: Coverage Status
-
- Simple integration of Flask and WTForms, including CSRF, file upload,
and reCAPTCHA.
-
- Links
- -----
-
- * `Documentation <https://flask-wtf.readthedocs.io>`_
- * `PyPI <https://pypi.python.org/pypi/Flask-WTF>`_
- * `GitHub <https://github.com/lepture/flask-wtf>`_
-
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
@@ -35,16 +16,40 @@
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >= 3.6
Description-Content-Type: text/x-rst
+Provides-Extra: email
+License-File: LICENSE
+
+Flask-WTF
+=========
+
+.. image::
https://github.com/wtforms/flask-wtf/actions/workflows/tests.yaml/badge.svg
+ :target: https://github.com/wtforms/flask-wtf/actions/
+ :alt: Test Status
+.. image::
https://codecov.io/gh/wtforms/flask-wtf/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/wtforms/flask-wtf
+ :alt: Coverage Status
+.. image:: https://readthedocs.org/projects/flask-wtf/badge/?version=latest
+ :target: https://flask-wtf.readthedocs.io/
+ :alt: Documentation
+
+Simple integration of Flask and WTForms, including CSRF, file upload, and
reCAPTCHA.
+
+Links
+-----
+
+* `Documentation <https://flask-wtf.readthedocs.io>`_
+* `PyPI <https://pypi.python.org/pypi/Flask-WTF>`_
+* `GitHub <https://github.com/wtforms/flask-wtf>`_
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/README.rst
new/Flask-WTF-0.15.1/README.rst
--- old/Flask-WTF-0.14.3/README.rst 2020-02-07 00:03:33.000000000 +0100
+++ new/Flask-WTF-0.15.1/README.rst 2021-05-25 20:01:28.000000000 +0200
@@ -1,12 +1,15 @@
Flask-WTF
=========
-.. image:: https://travis-ci.org/lepture/flask-wtf.svg?branch=master
- :target: https://travis-ci.org/lepture/flask-wtf
+.. image::
https://github.com/wtforms/flask-wtf/actions/workflows/tests.yaml/badge.svg
+ :target: https://github.com/wtforms/flask-wtf/actions/
:alt: Test Status
-.. image::
https://codecov.io/gh/lepture/flask-wtf/branch/master/graph/badge.svg
- :target: https://codecov.io/gh/lepture/flask-wtf
+.. image::
https://codecov.io/gh/wtforms/flask-wtf/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/wtforms/flask-wtf
:alt: Coverage Status
+.. image:: https://readthedocs.org/projects/flask-wtf/badge/?version=latest
+ :target: https://flask-wtf.readthedocs.io/
+ :alt: Documentation
Simple integration of Flask and WTForms, including CSRF, file upload, and
reCAPTCHA.
@@ -15,4 +18,4 @@
* `Documentation <https://flask-wtf.readthedocs.io>`_
* `PyPI <https://pypi.python.org/pypi/Flask-WTF>`_
-* `GitHub <https://github.com/lepture/flask-wtf>`_
+* `GitHub <https://github.com/wtforms/flask-wtf>`_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/_templates/useful-links.html
new/Flask-WTF-0.15.1/docs/_templates/useful-links.html
--- old/Flask-WTF-0.14.3/docs/_templates/useful-links.html 2018-11-11
15:43:08.000000000 +0100
+++ new/Flask-WTF-0.15.1/docs/_templates/useful-links.html 2021-05-25
20:01:28.000000000 +0200
@@ -1,6 +1,6 @@
<h3>Useful Links</h3>
<ul>
<li><a href="http://pypi.python.org/pypi/Flask-WTF">PyPI</a></li>
- <li><a href="https://github.com/lepture/flask-wtf">GitHub</a></li>
- <li><a href="https://github.com/lepture/flask-wtf/issues">Issue
Tracker</a></li>
+ <li><a href="https://github.com/wtforms/flask-wtf">GitHub</a></li>
+ <li><a href="https://github.com/wtforms/flask-wtf/issues">Issue
Tracker</a></li>
</ul>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/authors.rst
new/Flask-WTF-0.15.1/docs/authors.rst
--- old/Flask-WTF-0.14.3/docs/authors.rst 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/docs/authors.rst 2021-05-25 20:01:28.000000000
+0200
@@ -12,4 +12,4 @@
Find more contributors on GitHub_.
-.. _GitHub: https://github.com/lepture/flask-wtf/graphs/contributors
+.. _GitHub: https://github.com/wtforms/flask-wtf/graphs/contributors
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/changelog.rst
new/Flask-WTF-0.15.1/docs/changelog.rst
--- old/Flask-WTF-0.14.3/docs/changelog.rst 2020-02-07 00:08:04.000000000
+0100
+++ new/Flask-WTF-0.15.1/docs/changelog.rst 2021-05-25 20:01:28.000000000
+0200
@@ -1,6 +1,50 @@
Flask-WTF Changelog
===================
+
+Version 0.15.1
+--------------
+
+Released 2021-05-25
+
+- Add ``python_requires`` metadata to avoid installing on unsupported
+ Python versions. `442`_
+
+.. _442: https://github.com/wtforms/flask-wtf/pull/442
+
+
+Version 0.15.0
+--------------
+
+Released 2021-05-24
+
+- Drop support for Python < 3.6. `#416`_
+- ``FileSize`` validator. `#307`_, `#365`_
+- Extra requirement ``email`` installs the ``email_validator``
+ package. `#423`_
+- Fixed Flask 2.0 warnings. `#434`_
+- Various documentation fixes. `#315`_, `#321`_, `#335`_, `#344`_,
+ `#386`_, `#400`_, `#404`_, `#420`_, `#437`_
+- Various CI fixes. `#405`_, `#438`_
+
+.. _#307: https://github.com/wtforms/flask-wtf/pull/307
+.. _#315: https://github.com/wtforms/flask-wtf/pull/315
+.. _#321: https://github.com/wtforms/flask-wtf/pull/321
+.. _#335: https://github.com/wtforms/flask-wtf/pull/335
+.. _#344: https://github.com/wtforms/flask-wtf/pull/344
+.. _#365: https://github.com/wtforms/flask-wtf/pull/365
+.. _#386: https://github.com/wtforms/flask-wtf/pull/386
+.. _#400: https://github.com/wtforms/flask-wtf/pull/400
+.. _#404: https://github.com/wtforms/flask-wtf/pull/404
+.. _#405: https://github.com/wtforms/flask-wtf/pull/405
+.. _#416: https://github.com/wtforms/flask-wtf/pull/416
+.. _#420: https://github.com/wtforms/flask-wtf/pull/420
+.. _#423: https://github.com/wtforms/flask-wtf/pull/423
+.. _#434: https://github.com/wtforms/flask-wtf/pull/434
+.. _#437: https://github.com/wtforms/flask-wtf/pull/437
+.. _#438: https://github.com/wtforms/flask-wtf/pull/438
+
+
Version 0.14.3
--------------
@@ -17,7 +61,7 @@
- Fix bug where ``FlaskForm`` assumed ``meta`` argument was not ``None`` if it
was passed. (`#278`_)
-.. _#278: https://github.com/lepture/flask-wtf/issues/278
+.. _#278: https://github.com/wtforms/flask-wtf/issues/278
Version 0.14.1
--------------
@@ -34,8 +78,8 @@
WTForms ``FileField`` classes.
- The ``Optional`` validator now works with ``FileField``.
-.. _#276: https://github.com/lepture/flask-wtf/issues/276
-.. _#277: https://github.com/lepture/flask-wtf/pull/277
+.. _#276: https://github.com/wtforms/flask-wtf/issues/276
+.. _#277: https://github.com/wtforms/flask-wtf/pull/277
Version 0.14
------------
@@ -81,16 +125,16 @@
- ``FileField`` is deprecated because it no longer provides functionality over
the provided validators. Use ``wtforms.FileField`` directly. (`#272`_)
-.. _`#200`: https://github.com/lepture/flask-wtf/issues/200
-.. _`#209`: https://github.com/lepture/flask-wtf/pull/209
-.. _`#216`: https://github.com/lepture/flask-wtf/issues/216
-.. _`#227`: https://github.com/lepture/flask-wtf/issues/227
-.. _`#239`: https://github.com/lepture/flask-wtf/issues/239
-.. _`#243`: https://github.com/lepture/flask-wtf/pull/243
-.. _`#252`: https://github.com/lepture/flask-wtf/pull/252
-.. _`#264`: https://github.com/lepture/flask-wtf/pull/264
-.. _`#271`: https://github.com/lepture/flask-wtf/pull/271
-.. _`#272`: https://github.com/lepture/flask-wtf/pull/272
+.. _`#200`: https://github.com/wtforms/flask-wtf/issues/200
+.. _`#209`: https://github.com/wtforms/flask-wtf/pull/209
+.. _`#216`: https://github.com/wtforms/flask-wtf/issues/216
+.. _`#227`: https://github.com/wtforms/flask-wtf/issues/227
+.. _`#239`: https://github.com/wtforms/flask-wtf/issues/239
+.. _`#243`: https://github.com/wtforms/flask-wtf/pull/243
+.. _`#252`: https://github.com/wtforms/flask-wtf/pull/252
+.. _`#264`: https://github.com/wtforms/flask-wtf/pull/264
+.. _`#271`: https://github.com/wtforms/flask-wtf/pull/271
+.. _`#272`: https://github.com/wtforms/flask-wtf/pull/272
Version 0.13.1
--------------
@@ -100,8 +144,8 @@
- Deprecation warning for ``Form`` is shown during ``__init__`` instead of
immediately when subclassing. (`#262`_)
- Don't use ``pkg_resources`` to get version, for compatibility with GAE.
(`#261`_)
-.. _`#261`: https://github.com/lepture/flask-wtf/issues/261
-.. _`#262`: https://github.com/lepture/flask-wtf/issues/262
+.. _`#261`: https://github.com/wtforms/flask-wtf/issues/261
+.. _`#262`: https://github.com/wtforms/flask-wtf/issues/262
Version 0.13
------------
@@ -117,14 +161,14 @@
- ``form.data`` can be accessed multiple times without raising an exception.
(`#248`_)
- File extension with multiple parts (``.tar.gz``) can be used in the
``FileAllowed`` validator. (`#201`_)
-.. _`#187`: https://github.com/lepture/flask-wtf/pull/187
-.. _`#193`: https://github.com/lepture/flask-wtf/issues/193
-.. _`#201`: https://github.com/lepture/flask-wtf/issues/201
-.. _`#206`: https://github.com/lepture/flask-wtf/pull/206
-.. _`#217`: https://github.com/lepture/flask-wtf/issues/217
-.. _`#248`: https://github.com/lepture/flask-wtf/pull/248
-.. _`#250`: https://github.com/lepture/flask-wtf/pull/250
-.. _`#251`: https://github.com/lepture/flask-wtf/pull/251
+.. _`#187`: https://github.com/wtforms/flask-wtf/pull/187
+.. _`#193`: https://github.com/wtforms/flask-wtf/issues/193
+.. _`#201`: https://github.com/wtforms/flask-wtf/issues/201
+.. _`#206`: https://github.com/wtforms/flask-wtf/pull/206
+.. _`#217`: https://github.com/wtforms/flask-wtf/issues/217
+.. _`#248`: https://github.com/wtforms/flask-wtf/pull/248
+.. _`#250`: https://github.com/wtforms/flask-wtf/pull/250
+.. _`#251`: https://github.com/wtforms/flask-wtf/pull/251
Version 0.12
------------
@@ -142,7 +186,7 @@
- Use the new reCAPTCHA API via `#164`_.
-.. _`#164`: https://github.com/lepture/flask-wtf/pull/164
+.. _`#164`: https://github.com/wtforms/flask-wtf/pull/164
Version 0.10.3
@@ -154,8 +198,8 @@
- Support customize hidden tags via `#150`_.
- And many more bug fixes
-.. _`#150`: https://github.com/lepture/flask-wtf/pull/150
-.. _`#159`: https://github.com/lepture/flask-wtf/pull/159
+.. _`#150`: https://github.com/wtforms/flask-wtf/pull/150
+.. _`#159`: https://github.com/wtforms/flask-wtf/pull/159
Version 0.10.2
--------------
@@ -164,7 +208,7 @@
- Update translation for reCaptcha via `#146`_.
-.. _`#146`: https://github.com/lepture/flask-wtf/pull/146
+.. _`#146`: https://github.com/wtforms/flask-wtf/pull/146
Version 0.10.1
@@ -176,8 +220,8 @@
- Update requirement Werkzeug>=0.9.5
- Fix CsrfProtect exempt for blueprints via `#143`_.
-.. _`#145`: https://github.com/lepture/flask-wtf/pull/145
-.. _`#143`: https://github.com/lepture/flask-wtf/pull/143
+.. _`#145`: https://github.com/wtforms/flask-wtf/pull/145
+.. _`#143`: https://github.com/wtforms/flask-wtf/pull/143
Version 0.10.0
--------------
@@ -189,7 +233,7 @@
- Fix csrf validation without time limit (time_limit=False)
- CSRF exempt supports blueprint `#111`_.
-.. _`#111`: https://github.com/lepture/flask-wtf/issues/111
+.. _`#111`: https://github.com/wtforms/flask-wtf/issues/111
Version 0.9.5
-------------
@@ -199,8 +243,8 @@
- ``csrf_token`` for all template types `#112`_.
- Make FileRequired a subclass of InputRequired `#108`_.
-.. _`#108`: https://github.com/lepture/flask-wtf/pull/108
-.. _`#112`: https://github.com/lepture/flask-wtf/pull/112
+.. _`#108`: https://github.com/wtforms/flask-wtf/pull/108
+.. _`#112`: https://github.com/wtforms/flask-wtf/pull/112
Version 0.9.4
-------------
@@ -220,8 +264,8 @@
- Fix validation of recaptcha when app in testing mode `#89`_.
- Bugfix for csrf module `#91`_
-.. _`#89`: https://github.com/lepture/flask-wtf/pull/89
-.. _`#91`: https://github.com/lepture/flask-wtf/pull/91
+.. _`#89`: https://github.com/wtforms/flask-wtf/pull/89
+.. _`#91`: https://github.com/wtforms/flask-wtf/pull/91
Version 0.9.2
@@ -234,9 +278,9 @@
- No DateInput widget in html5 `#81`_.
- PUT and PATCH for CSRF `#86`_.
-.. _`#77`: https://github.com/lepture/flask-wtf/issues/77
-.. _`#81`: https://github.com/lepture/flask-wtf/issues/81
-.. _`#86`: https://github.com/lepture/flask-wtf/issues/86
+.. _`#77`: https://github.com/wtforms/flask-wtf/issues/77
+.. _`#81`: https://github.com/wtforms/flask-wtf/issues/81
+.. _`#86`: https://github.com/wtforms/flask-wtf/issues/86
Version 0.9.1
@@ -246,7 +290,7 @@
This is a patch version for backward compitable for Flask<0.10 `#82`_.
-.. _`#82`: https://github.com/lepture/flask-wtf/issues/82
+.. _`#82`: https://github.com/wtforms/flask-wtf/issues/82
Version 0.9.0
-------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/conf.py
new/Flask-WTF-0.15.1/docs/conf.py
--- old/Flask-WTF-0.14.3/docs/conf.py 2020-02-07 00:03:33.000000000 +0100
+++ new/Flask-WTF-0.15.1/docs/conf.py 2021-05-24 19:21:41.000000000 +0200
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
import os
import sys
from datetime import datetime
@@ -43,7 +41,7 @@
# General information about the project.
project = 'Flask-WTF'
-copyright = '2010 - {0}'.format(datetime.utcnow().year)
+copyright = f'2010 - {datetime.utcnow().year}'
author = 'Dan Jacob'
# The version info for the project you're documenting, acts as replacement for
@@ -132,7 +130,7 @@
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
-html_title = '{0} {1}'.format(project, version)
+html_title = f'{project} {version}'
# A shorter title for the navigation bar. Default is the same as html_title.
#
@@ -337,8 +335,8 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
- 'flask': ('http://flask.pocoo.org/docs/latest/', None),
- 'werkzeug': ('http://werkzeug.pocoo.org/docs/latest/', None),
- 'wtforms': ('https://wtforms.readthedocs.io/en/latest/', None),
+ 'flask': ('https://flask.palletsprojects.com/en/1.1.x/', None),
+ 'werkzeug': ('https://werkzeug.palletsprojects.com/en/1.0.x/', None),
+ 'wtforms': ('https://wtforms.readthedocs.io/en/2.3.x/', None),
'flask_uploads': ('https://pythonhosted.org/Flask-Uploads', None),
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/config.rst
new/Flask-WTF-0.15.1/docs/config.rst
--- old/Flask-WTF-0.14.3/docs/config.rst 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/docs/config.rst 2021-05-24 19:21:41.000000000
+0200
@@ -2,7 +2,8 @@
=============
==========================
=====================================================
-``WTF_CSRF_ENABLED`` Set to ``False`` to disable all CSRF protection.
+``WTF_CSRF_ENABLED`` Set to ``False`` to disable all CSRF protection.
+ Default is ``True``.
``WTF_CSRF_CHECK_DEFAULT`` When using the CSRF protection extension, this
controls whether every view is protected by default.
Default is ``True``.
@@ -11,7 +12,7 @@
``WTF_CSRF_METHODS`` HTTP methods to protect from CSRF. Default is
``{'POST', 'PUT', 'PATCH', 'DELETE'}``.
``WTF_CSRF_FIELD_NAME`` Name of the form field and session key that holds
the
- CSRF token.
+ CSRF token. Default is ``csrf_token``.
``WTF_CSRF_HEADERS`` HTTP headers to search for CSRF token when it is not
provided in the form. Default is
``['X-CSRFToken', 'X-CSRF-Token']``.
@@ -22,8 +23,13 @@
that the referrer matches the host. Only applies to
HTTPS requests. Default is ``True``.
``WTF_I18N_ENABLED`` Set to ``False`` to disable Flask-Babel I18N
support.
+ Also set to ``False`` if you want to use WTForms's
+ built-in messages directly, see more info `here`_.
+ Default is ``True``.
==========================
=====================================================
+.. _here:
https://wtforms.readthedocs.io/en/stable/i18n.html#using-the-built-in-translations-provider
+
Recaptcha
---------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/csrf.rst
new/Flask-WTF-0.15.1/docs/csrf.rst
--- old/Flask-WTF-0.14.3/docs/csrf.rst 2020-02-07 00:15:29.000000000 +0100
+++ new/Flask-WTF-0.15.1/docs/csrf.rst 2021-05-24 19:21:41.000000000 +0200
@@ -74,6 +74,14 @@
});
</script>
+In Axios you can set the header for all requests with
``axios.defaults.headers.common``.
+
+.. sourcecode:: html+jinja
+
+ <script type="text/javascript">
+ axios.defaults.headers.common["X-CSRFToken"] = "{{ csrf_token() }}";
+ </script>
+
Customize the error response
----------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/form.rst
new/Flask-WTF-0.15.1/docs/form.rst
--- old/Flask-WTF-0.14.3/docs/form.rst 2020-02-07 00:17:06.000000000 +0100
+++ new/Flask-WTF-0.15.1/docs/form.rst 2021-05-25 20:01:28.000000000 +0200
@@ -7,7 +7,7 @@
.. currentmodule:: flask_wtf
Without any configuration, the :class:`FlaskForm` will be a session secure
-form with csrf protection. We encourage you do nothing.
+form with csrf protection. We encourage you not to change this.
But if you want to disable the csrf protection, you can pass::
@@ -123,8 +123,7 @@
username = TextField('Username')
recaptcha = RecaptchaField()
-This comes together with a number of configuration, which you have to
-implement them.
+This comes with a number of configuration variables, some of which you have to
configure.
======================= ==============================================
RECAPTCHA_PUBLIC_KEY **required** A public key.
@@ -132,7 +131,7 @@
RECAPTCHA_API_SERVER **optional** Specify your Recaptcha API server.
RECAPTCHA_PARAMETERS **optional** A dict of JavaScript (api.js) parameters.
RECAPTCHA_DATA_ATTRS **optional** A dict of data attributes options.
- https://developers.google.com/recaptcha/docs/display
+
https://developers.google.com/recaptcha/docs/display#javascript_resource_apijs_parameters
======================= ==============================================
Example of RECAPTCHA_PARAMETERS, and RECAPTCHA_DATA_ATTRS::
@@ -140,8 +139,8 @@
RECAPTCHA_PARAMETERS = {'hl': 'zh', 'render': 'explicit'}
RECAPTCHA_DATA_ATTRS = {'theme': 'dark'}
-For testing your application, if ``app.testing`` is ``True``, recaptcha
-field will always be valid for you convenience.
+For your convenience, when testing your application, if ``app.testing`` is
``True``, the recaptcha
+field will always be valid.
And it can be easily setup in the templates:
@@ -154,4 +153,4 @@
We have an example for you: `recaptcha@github`_.
-.. _`recaptcha@github`:
https://github.com/lepture/flask-wtf/tree/master/examples/recaptcha
+.. _`recaptcha@github`:
https://github.com/wtforms/flask-wtf/tree/main/examples/recaptcha
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/install.rst
new/Flask-WTF-0.15.1/docs/install.rst
--- old/Flask-WTF-0.14.3/docs/install.rst 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/docs/install.rst 2021-05-25 20:01:28.000000000
+0200
@@ -19,12 +19,12 @@
The latest code is available from `GitHub`_. Clone the repository then install
using pip. ::
- git clone https://github.com/lepture/flask-wtf
+ git clone https://github.com/wtforms/flask-wtf
pip install -e ./flask-wtf
Or install the latest build from an `archive`_. ::
- pip install -U https://github.com/lepture/flask-wtf/tarball/master
+ pip install -U https://github.com/wtforms/flask-wtf/archive/main.tar.gz
-.. _GitHub: https://github.com/lepture/flask-wtf
-.. _archive: https://github.com/lepture/flask-wtf/archive/master.tar.gz
+.. _GitHub: https://github.com/wtforms/flask-wtf
+.. _archive: https://github.com/wtforms/flask-wtf/archive/main.tar.gz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/docs/quickstart.rst
new/Flask-WTF-0.15.1/docs/quickstart.rst
--- old/Flask-WTF-0.14.3/docs/quickstart.rst 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/docs/quickstart.rst 2021-05-24 19:21:41.000000000
+0200
@@ -60,7 +60,21 @@
return render_template('submit.html', form=form)
Note that you don't have to pass ``request.form`` to Flask-WTF; it will
-load automatically. And the convenience ``validate_on_submit`` will check
+load automatically. And the convenient ``validate_on_submit`` will check
if it is a POST request and if it is valid.
+If your forms include validation, you'll need to add to your template to
display
+any error messages. Using the ``form.name`` field from the example above, that
+would look like this:
+
+.. sourcecode:: html+jinja
+
+ {% if form.name.errors %}
+ <ul class="errors">
+ {% for error in form.name %}
+ <li>{{ error }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+
Heading over to :doc:`form` to learn more skills.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/__init__.py
new/Flask-WTF-0.15.1/flask_wtf/__init__.py
--- old/Flask-WTF-0.14.3/flask_wtf/__init__.py 2020-02-07 00:08:04.000000000
+0100
+++ new/Flask-WTF-0.15.1/flask_wtf/__init__.py 2021-05-25 20:01:28.000000000
+0200
@@ -1,7 +1,5 @@
-from __future__ import absolute_import
-
from .csrf import CSRFProtect, CsrfProtect
from .form import FlaskForm, Form
from .recaptcha import *
-__version__ = '0.14.3'
+__version__ = '0.15.1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/_compat.py
new/Flask-WTF-0.15.1/flask_wtf/_compat.py
--- old/Flask-WTF-0.14.3/flask_wtf/_compat.py 2020-02-07 00:06:34.000000000
+0100
+++ new/Flask-WTF-0.15.1/flask_wtf/_compat.py 2021-05-24 19:21:41.000000000
+0200
@@ -1,30 +1,16 @@
-import sys
import warnings
-PY2 = sys.version_info[0] == 2
-
-if not PY2:
- text_type = str
- string_types = (str,)
- from collections import abc
- from urllib.parse import urlparse
-else:
- text_type = unicode
- string_types = (str, unicode)
- import collections as abc
- from urlparse import urlparse
-
def to_bytes(text):
"""Transform string to bytes."""
- if isinstance(text, text_type):
+ if isinstance(text, str):
text = text.encode('utf-8')
return text
def to_unicode(input_bytes, encoding='utf-8'):
"""Decodes input_bytes to text if needed."""
- if not isinstance(input_bytes, string_types):
+ if not isinstance(input_bytes, str):
input_bytes = input_bytes.decode(encoding)
return input_bytes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/csrf.py
new/Flask-WTF-0.15.1/flask_wtf/csrf.py
--- old/Flask-WTF-0.14.3/flask_wtf/csrf.py 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/flask_wtf/csrf.py 2021-05-24 19:21:41.000000000
+0200
@@ -1,17 +1,18 @@
import hashlib
+import hmac
import logging
import os
import warnings
+from urllib.parse import urlparse
from functools import wraps
from flask import Blueprint, current_app, g, request, session
from itsdangerous import BadData, SignatureExpired, URLSafeTimedSerializer
from werkzeug.exceptions import BadRequest
-from werkzeug.security import safe_str_cmp
from wtforms import ValidationError
from wtforms.csrf.core import CSRF
-from ._compat import FlaskWTFDeprecationWarning, string_types, urlparse
+from ._compat import FlaskWTFDeprecationWarning
__all__ = ('generate_csrf', 'validate_csrf', 'CSRFProtect')
logger = logging.getLogger(__name__)
@@ -26,7 +27,7 @@
:param secret_key: Used to securely sign the token. Default is
``WTF_CSRF_SECRET_KEY`` or ``SECRET_KEY``.
- :param token_key: Key where token is stored in session for comparision.
+ :param token_key: Key where token is stored in session for comparison.
Default is ``WTF_CSRF_FIELD_NAME`` or ``'csrf_token'``.
"""
@@ -65,7 +66,7 @@
``WTF_CSRF_SECRET_KEY`` or ``SECRET_KEY``.
:param time_limit: Number of seconds that the token is valid. Default is
``WTF_CSRF_TIME_LIMIT`` or 3600 seconds (60 minutes).
- :param token_key: Key where token is stored in session for comparision.
+ :param token_key: Key where token is stored in session for comparison.
Default is ``WTF_CSRF_FIELD_NAME`` or ``'csrf_token'``.
:raises ValidationError: Contains the reason that validation failed.
@@ -102,7 +103,7 @@
except BadData:
raise ValidationError('The CSRF token is invalid.')
- if not safe_str_cmp(session[field_name], token):
+ if not hmac.compare_digest(session[field_name], token):
raise ValidationError('The CSRF tokens do not match.')
@@ -133,7 +134,7 @@
class _FlaskFormCSRF(CSRF):
def setup_form(self, form):
self.meta = form.meta
- return super(_FlaskFormCSRF, self).setup_form(form)
+ return super().setup_form(form)
def generate_csrf_token(self, csrf_token_field):
return generate_csrf(
@@ -158,7 +159,7 @@
raise
-class CSRFProtect(object):
+class CSRFProtect:
"""Enable CSRF protection globally for a Flask app.
::
@@ -216,7 +217,7 @@
return
view = app.view_functions.get(request.endpoint)
- dest = '{0}.{1}'.format(view.__module__, view.__name__)
+ dest = f'{view.__module__}.{view.__name__}'
if dest in self._exempt_views:
return
@@ -262,7 +263,7 @@
if not request.referrer:
self._error_response('The referrer header is missing.')
- good_referrer = 'https://{0}/'.format(request.host)
+ good_referrer = f'https://{request.host}/'
if not same_origin(request.referrer, good_referrer):
self._error_response('The referrer does not match the host.')
@@ -290,7 +291,7 @@
self._exempt_blueprints.add(view.name)
return view
- if isinstance(view, string_types):
+ if isinstance(view, str):
view_location = view
else:
view_location = '.'.join((view.__module__, view.__name__))
@@ -346,7 +347,7 @@
'"flask_wtf.CsrfProtect" has been renamed to "CSRFProtect" '
'and will be removed in 1.0.'
), stacklevel=2)
- super(CsrfProtect, self).__init__(app=app)
+ super().__init__(app=app)
class CSRFError(BadRequest):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/file.py
new/Flask-WTF-0.15.1/flask_wtf/file.py
--- old/Flask-WTF-0.14.3/flask_wtf/file.py 2020-02-07 00:06:34.000000000
+0100
+++ new/Flask-WTF-0.15.1/flask_wtf/file.py 2021-05-24 19:21:41.000000000
+0200
@@ -2,9 +2,9 @@
from werkzeug.datastructures import FileStorage
from wtforms import FileField as _FileField
-from wtforms.validators import DataRequired, StopValidation
+from wtforms.validators import DataRequired, StopValidation, ValidationError
-from ._compat import abc
+from collections import abc
from ._compat import FlaskWTFDeprecationWarning
@@ -55,7 +55,7 @@
file_required = FileRequired
-class FileAllowed(object):
+class FileAllowed:
"""Validates that the uploaded file is allowed by a given list of
extensions or a Flask-Uploads :class:`~flaskext.uploads.UploadSet`.
@@ -91,3 +91,38 @@
file_allowed = FileAllowed
+
+
+class FileSize(object):
+ """Validates that the uploaded file is within a minimum and maximum file
size (set in bytes).
+
+ :param min_size: minimum allowed file size (in bytes). Defaults to 0 bytes.
+ :param max_size: maximum allowed file size (in bytes).
+ :param message: error message
+
+ You can also use the synonym ``file_size``.
+ """
+
+ def __init__(self, max_size, min_size=0, message=None):
+ self.min_size = min_size
+ self.max_size = max_size
+ self.message = message
+
+ def __call__(self, form, field):
+ if not (isinstance(field.data, FileStorage) and field.data):
+ return
+
+ file_size = len(field.data.read())
+ field.data.seek(0) # reset cursor position to beginning of file
+
+ if (file_size < self.min_size) or (file_size > self.max_size):
+ # the file is too small or too big => validation failure
+ raise ValidationError(self.message or field.gettext(
+ 'File must be between {min_size} and {max_size} bytes.'.format(
+ min_size=self.min_size,
+ max_size=self.max_size
+ )
+ ))
+
+
+file_size = FileSize
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/form.py
new/Flask-WTF-0.15.1/flask_wtf/form.py
--- old/Flask-WTF-0.14.3/flask_wtf/form.py 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/flask_wtf/form.py 2021-05-24 19:21:41.000000000
+0200
@@ -1,14 +1,14 @@
import warnings
from flask import current_app, request, session
-from jinja2 import Markup
+from markupsafe import Markup
from werkzeug.datastructures import CombinedMultiDict, ImmutableMultiDict
from werkzeug.utils import cached_property
from wtforms import Form
from wtforms.meta import DefaultMeta
from wtforms.widgets import HiddenInput
-from ._compat import FlaskWTFDeprecationWarning, string_types, text_type
+from ._compat import FlaskWTFDeprecationWarning
from .csrf import _FlaskFormCSRF
try:
@@ -17,7 +17,7 @@
translations = None # babel not installed
-SUBMIT_METHODS = set(('POST', 'PUT', 'PATCH', 'DELETE'))
+SUBMIT_METHODS = {'POST', 'PUT', 'PATCH', 'DELETE'}
_Auto = object()
@@ -84,7 +84,7 @@
kwargs['meta'] = kwargs.get('meta') or {}
kwargs['meta'].setdefault('csrf', csrf_enabled)
- super(FlaskForm, self).__init__(formdata=formdata, **kwargs)
+ super().__init__(formdata=formdata, **kwargs)
def is_submitted(self):
"""Consider the form submitted if there is an active request and
@@ -122,7 +122,7 @@
def hidden_fields(fields):
for f in fields:
- if isinstance(f, string_types):
+ if isinstance(f, str):
f = getattr(self, f, None)
if f is None or not isinstance(f.widget, HiddenInput):
@@ -131,7 +131,7 @@
yield f
return Markup(
- u'\n'.join(text_type(f) for f in hidden_fields(fields or self))
+ '\n'.join(str(f) for f in hidden_fields(fields or self))
)
@@ -154,4 +154,4 @@
'"flask_wtf.Form" has been renamed to "FlaskForm" '
'and will be removed in 1.0.'
), stacklevel=3)
- super(Form, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/i18n.py
new/Flask-WTF-0.15.1/flask_wtf/i18n.py
--- old/Flask-WTF-0.14.3/flask_wtf/i18n.py 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/flask_wtf/i18n.py 2021-05-24 19:21:41.000000000
+0200
@@ -33,7 +33,7 @@
return translations
-class Translations(object):
+class Translations:
def gettext(self, string):
t = _get_translations()
return string if t is None else t.ugettext(string)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/recaptcha/fields.py
new/Flask-WTF-0.15.1/flask_wtf/recaptcha/fields.py
--- old/Flask-WTF-0.14.3/flask_wtf/recaptcha/fields.py 2018-11-11
15:43:08.000000000 +0100
+++ new/Flask-WTF-0.15.1/flask_wtf/recaptcha/fields.py 2021-05-24
19:21:41.000000000 +0200
@@ -14,4 +14,4 @@
def __init__(self, label='', validators=None, **kwargs):
validators = validators or [Recaptcha()]
- super(RecaptchaField, self).__init__(label, validators, **kwargs)
+ super().__init__(label, validators, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/recaptcha/validators.py
new/Flask-WTF-0.15.1/flask_wtf/recaptcha/validators.py
--- old/Flask-WTF-0.14.3/flask_wtf/recaptcha/validators.py 2020-02-07
00:03:33.000000000 +0100
+++ new/Flask-WTF-0.15.1/flask_wtf/recaptcha/validators.py 2021-05-24
19:21:41.000000000 +0200
@@ -1,8 +1,4 @@
-try:
- import urllib2 as http
-except ImportError:
- # Python 3
- from urllib import request as http
+from urllib import request as http
import json
@@ -24,7 +20,7 @@
__all__ = ["Recaptcha"]
-class Recaptcha(object):
+class Recaptcha:
"""Validates a ReCaptcha."""
def __init__(self, message=None):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/flask_wtf/recaptcha/widgets.py
new/Flask-WTF-0.15.1/flask_wtf/recaptcha/widgets.py
--- old/Flask-WTF-0.14.3/flask_wtf/recaptcha/widgets.py 2020-02-07
00:03:33.000000000 +0100
+++ new/Flask-WTF-0.15.1/flask_wtf/recaptcha/widgets.py 2021-05-24
19:21:41.000000000 +0200
@@ -1,12 +1,10 @@
-# -*- coding: utf-8 -*-
-
from flask import Markup, current_app, json
from werkzeug.urls import url_encode
JSONEncoder = json.JSONEncoder
-RECAPTCHA_SCRIPT = u'https://www.google.com/recaptcha/api.js'
-RECAPTCHA_TEMPLATE = u'''
+RECAPTCHA_SCRIPT = 'https://www.google.com/recaptcha/api.js'
+RECAPTCHA_TEMPLATE = '''
<script src='%s' async defer></script>
<div class="g-recaptcha" %s></div>
'''
@@ -14,7 +12,7 @@
__all__ = ['RecaptchaWidget']
-class RecaptchaWidget(object):
+class RecaptchaWidget:
def recaptcha_html(self, public_key):
html = current_app.config.get('RECAPTCHA_HTML')
@@ -23,11 +21,11 @@
params = current_app.config.get('RECAPTCHA_PARAMETERS')
script = RECAPTCHA_SCRIPT
if params:
- script += u'?' + url_encode(params)
+ script += '?' + url_encode(params)
attrs = current_app.config.get('RECAPTCHA_DATA_ATTRS', {})
attrs['sitekey'] = public_key
- snippet = u' '.join([u'data-%s="%s"' % (k, attrs[k]) for k in attrs])
+ snippet = ' '.join(['data-{}="{}"'.format(k, attrs[k]) for k in attrs])
return Markup(RECAPTCHA_TEMPLATE % (script, snippet))
def __call__(self, field, error=None, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/setup.py
new/Flask-WTF-0.15.1/setup.py
--- old/Flask-WTF-0.14.3/setup.py 2020-02-07 00:13:19.000000000 +0100
+++ new/Flask-WTF-0.15.1/setup.py 2021-05-25 20:01:28.000000000 +0200
@@ -6,8 +6,8 @@
setup(
name='Flask-WTF',
- version='0.14.3',
- url='https://github.com/lepture/flask-wtf',
+ version='0.15.1',
+ url='https://github.com/wtforms/flask-wtf',
license='BSD',
author='Dan Jacob',
author_email='[email protected]',
@@ -18,11 +18,13 @@
packages=find_packages(exclude=('tests',)),
zip_safe=False,
platforms='any',
+ python_requires=">= 3.6",
install_requires=[
'Flask',
'WTForms',
'itsdangerous',
],
+ extras_require={'email': ['email-validator']},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
@@ -31,14 +33,11 @@
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/tests/conftest.py
new/Flask-WTF-0.15.1/tests/conftest.py
--- old/Flask-WTF-0.14.3/tests/conftest.py 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/tests/conftest.py 2021-05-24 19:21:41.000000000
+0200
@@ -10,7 +10,7 @@
if rv is None:
rv = ''
- return super(Flask, self).make_response(rv)
+ return super().make_response(rv)
@pytest.fixture
@@ -19,13 +19,13 @@
return app
[email protected]_fixture
[email protected]
def app_ctx(app):
with app.app_context() as ctx:
yield ctx
[email protected]_fixture
[email protected]
def req_ctx(app):
with app.test_request_context() as ctx:
yield ctx
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/tests/test_file.py
new/Flask-WTF-0.15.1/tests/test_file.py
--- old/Flask-WTF-0.14.3/tests/test_file.py 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/tests/test_file.py 2021-05-24 19:21:41.000000000
+0200
@@ -4,7 +4,7 @@
from flask_wtf import FlaskForm
from flask_wtf._compat import FlaskWTFDeprecationWarning
-from flask_wtf.file import FileAllowed, FileField, FileRequired
+from flask_wtf.file import FileAllowed, FileField, FileRequired, FileSize
@pytest.fixture
@@ -77,6 +77,40 @@
assert f.file.errors[0] == 'File does not have an approved extension.'
+def test_file_size_no_file_passes_validation(form):
+ form.file.kwargs['validators'] = [FileSize(max_size=100)]
+ f = form()
+ assert f.validate()
+
+
+def test_file_size_small_file_passes_validation(form, tmpdir):
+ form.file.kwargs['validators'] = [FileSize(max_size=100)]
+ test_file_smaller_than_max = tmpdir.join("test_file_smaller_than_max.txt")
+ test_file_smaller_than_max.write(b"\0")
+
+ f = form(file=FileStorage(open(test_file_smaller_than_max.strpath, 'rb')))
+
+ assert f.validate()
+
+
[email protected]("min_size, max_size, invalid_file_size", [
+ (1, 100, 0),
+ (0, 100, 101)
+])
+def test_file_size_invalid_file_size_fails_validation(form, min_size,
max_size, invalid_file_size, tmpdir):
+ form.file.kwargs['validators'] = [FileSize(min_size=min_size,
max_size=max_size)]
+ test_file_invalid_size = tmpdir.join("test_file_invalid_size.txt")
+ test_file_invalid_size.write(b"\0" * invalid_file_size)
+
+ f = form(file=FileStorage(open(test_file_invalid_size.strpath, 'rb')))
+
+ assert not f.validate()
+ assert f.file.errors[0] == 'File must be between {min_size} and {max_size}
bytes.'.format(
+ min_size=min_size,
+ max_size=max_size
+ )
+
+
def test_validate_base_field(req_ctx):
class F(FlaskForm):
class Meta:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/tests/test_i18n.py
new/Flask-WTF-0.15.1/tests/test_i18n.py
--- old/Flask-WTF-0.14.3/tests/test_i18n.py 2020-02-07 00:03:33.000000000
+0100
+++ new/Flask-WTF-0.15.1/tests/test_i18n.py 2021-05-24 19:21:41.000000000
+0200
@@ -1,4 +1,3 @@
-# coding=utf8
import pytest
from flask import request
from wtforms import StringField
@@ -49,9 +48,9 @@
if not app.config.get('WTF_I18N_ENABLED', True):
assert form.name.errors[0] == 'This field is required.'
elif not form.name.data:
- assert form.name.errors[0] == u'???????????????????????????'
+ assert form.name.errors[0] == '???????????????????????????'
else:
- assert form.name.errors[0] == u'???????????????????????? 8
????????????'
+ assert form.name.errors[0] == '???????????????????????? 8
????????????'
client.post('/', headers={'Accept-Language': 'zh-CN,zh;q=0.8'})
client.post(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/tests/test_recaptcha.py
new/Flask-WTF-0.15.1/tests/test_recaptcha.py
--- old/Flask-WTF-0.14.3/tests/test_recaptcha.py 2020-02-07
00:03:33.000000000 +0100
+++ new/Flask-WTF-0.15.1/tests/test_recaptcha.py 2021-05-24
19:21:41.000000000 +0200
@@ -24,7 +24,7 @@
return app
[email protected]_fixture(autouse=True)
[email protected](autouse=True)
def req_ctx(app):
with app.test_request_context(
data={'g-recaptcha-response': 'pass'}
@@ -77,7 +77,7 @@
assert f.recaptcha.errors[0] == 'The response parameter is missing.'
-class MockResponse(object):
+class MockResponse:
def __init__(self, code, error='invalid-input-response', read_bytes=False):
self.code = code
self.data = json.dumps({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-WTF-0.14.3/tox.ini new/Flask-WTF-0.15.1/tox.ini
--- old/Flask-WTF-0.14.3/tox.ini 2020-02-07 00:13:19.000000000 +0100
+++ new/Flask-WTF-0.15.1/tox.ini 2021-05-24 19:21:41.000000000 +0200
@@ -1,7 +1,7 @@
[tox]
envlist =
- py{27,34,35,36,37,38}
- pypy
+ py{36,37,38,39}
+ pypy3
py-babelex
py-no-babel
docs-html
@@ -30,7 +30,7 @@
[testenv:docs-html]
deps =
- sphinx
+ git+https://github.com/sphinx-doc/sphinx.git@96dbe5e3
flask-sphinx-themes
commands =
sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html
@@ -49,7 +49,7 @@
coverage html
[testenv:codecov]
-passenv = CI TRAVIS TRAVIS_*
+passenv = TOXENV CI CODECOV_*
deps = codecov
skip_install = true
commands =
++++++ fix-ModuleNotFoundError-wtforms-compat.patch ++++++
--- a/tests/test_form.py
+++ b/tests/test_form.py
@@ -2,7 +2,11 @@ from io import BytesIO
from flask import json, request
from wtforms import FileField, HiddenField, IntegerField, StringField
-from wtforms.compat import with_metaclass
+try:
+ from wtforms.compat import with_metaclass
+except ImportError:
+ def with_metaclass(meta, base=object):
+ return meta("NewBase", (base,), {})
from wtforms.form import FormMeta
from wtforms.validators import DataRequired
from wtforms.widgets import HiddenInput
++++++ fix-ModuleNotFoundError-wtforms-widgets-html5.patch ++++++
--- a/flask_wtf/html5.py
+++ b/flask_wtf/html5.py
@@ -8,5 +8,9 @@ warnings.warn(FlaskWTFDeprecationWarning
'and "wtforms.widgets.html5".'
), stacklevel=2)
-from wtforms.widgets.html5 import *
-from wtforms.fields.html5 import *
+try:
+ from wtforms.widgets.html5 import *
+ from wtforms.fields.html5 import *
+except ImportError:
+ from wtforms.widgets.core import *
+ from wtforms.fields.core import *