-
Notifications
You must be signed in to change notification settings - Fork 310
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
extra_validators change breaks many many forms #547
Comments
Hmm - this is certainly going to break a lot of things, and it won't be easy to have extensions/apps that work with both 1.0.1 and 1.1.0 - but I see the utility in the change and not sure a better way to do this.... |
Sorry - confusing myself - yes this is an issue with I believe a very simple fix:
should be: |
@jwag956 Yeah, this is also a problem in pgadmin with the following error when user clicks login button. (pgadmin-org/pgadmin4@e0b670f) When I reflect on your code, then it works! (w/ @chlrlrhs95) |
Sure! Go on and I will try to release 1.1.1 tonight. |
Co-authored-by: jwag956 <jwag.wagner@gmail.com> Co-authored-by: chlrlrhs95 <chlrlrhs95@naver.com>
Co-authored-by: jwag956 <jwag.wagner@gmail.com> Co-authored-by: chlrlrhs95 <chlrlrhs95@naver.com>
Co-authored-by: jwag956 <jwag.wagner@gmail.com> Co-authored-by: chlrlrhs95 <chlrlrhs95@naver.com>
Oh, sorry... I re-test but it does not fix the error. |
That simple fix worked for me (i.e. Flask-Security-Too unit tests now pass). |
@jwag956 Could you give me some advice? {"success":0,"errormsg":"LoginForm.validate() got an unexpected keyword argument 'extra_validators'","info":"","result":null,"data":null} Why does keyword passing not working in my case (for pgadmin4==6.19 with fixed flask-wtf 1.1.0 which was fixed with this change) wtforms receive exactly same name: extra_validators.. |
They added 'extra_validators' in 1.1.0 - to validate_on_submit - but didn't pass that as a keyword param to validate |
I fixed my comment a few minutes ago. I changed that code on flask wtf 1.1.0! |
It's likely you need to add update your |
The default validate() method in Flask-Security takes **kwargs - so should work fine. Do you have your own LoginForm? or are you using FS's Loginform? |
Probably pgadmin uses like that. I will dig it. Thank you! |
I figured it out. pgadmin4 uses LoginForm of Flask-Security. And Flask-wtf's validate_on_submit function calls their derived class Flask-Security 4.1.5 LoginForm's validate function and that does not receive extra_validators and it throws an error. However, now the master branch receives extra_validators. You are right! So, if pgadmin uses the next version of flask-security, then it works with flask-wtf 1.1.0. |
In 1.1.0 the 'extra_validators' parameter was added as a positional parameter to the form.validate() call, whereas in WTForms and Flask-WTForms.validate_on_submit() it is a keyword parameter.
To reproduce:
Create a form with a validate() method which takes no parameters.
Desired Outcome:
FlaskForms.validate() shouldn't require any positional parameters (and therefore be backwards compatible with prior releases).
Environment:
The text was updated successfully, but these errors were encountered: