Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow optional extra_validators parameter in validate methods of forms.py #51

Closed
GraemeWatt opened this issue Jan 16, 2023 · 3 comments
Closed

Comments

@GraemeWatt
Copy link

GraemeWatt commented Jan 16, 2023

This package requires Flask-WTF>=1.0.0, but it breaks with the latest Flask-WTF 1.1.0 released yesterday, where an error message TypeError: validate() takes 1 positional argument but 2 were given is obtained from this line:

if form.validate_on_submit():

The failure is due to a change introduced in wtforms/flask-wtf#479. To fix the problem, an optional argument extra_validators=None should be added to each of the validate methods in forms.py. Alternatively, add **kwargs to the validate methods as done in Flask-Middleware/flask-security#566. Until a new fixed release is made of this package, it will be necessary to pin Flask-WTF<1.1.0.

@kpsherva
Copy link

the issue was introduced by broken compatibility in flask-wtf v1.1.0. There is already patch (v1.1.1) provided which fixes the method signature, therefore I am closing the issue

@GraemeWatt
Copy link
Author

GraemeWatt commented Jan 18, 2023

Flask-WTF 1.1.1 gives an error message TypeError: validate() got an unexpected keyword argument 'extra_validators'. Please reopen this issue. You need to replace validate(self) with validate(self, **kwargs) four times in forms.py and release a new version of this package, then bump the version installed by invenio-accounts. See also comments in wtforms/flask-wtf#547.

@GraemeWatt
Copy link
Author

This issue was addressed by PR #52 and I confirm that the release v3.1.4 works. You might want to change Flask-Security-Invenio>=3.1.3 to Flask-Security-Invenio>=3.1.4 in the next release of invenio-accounts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants