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

Cannot send meta=None in from_json to flask-wtf>=0.14 #47

Open
virlos opened this issue Jan 9, 2017 · 4 comments
Open

Cannot send meta=None in from_json to flask-wtf>=0.14 #47

virlos opened this issue Jan 9, 2017 · 4 comments

Comments

@virlos
Copy link

virlos commented Jan 9, 2017

The classmethod from_json has default meta=None, which fails at https://github.com/lepture/flask-wtf/blob/master/flask_wtf/form.py#L85 as that assumes meta is a dict if present:

File "/usr/local/lib/python2.7/dist-packages/wtforms_json/init.py", line 233, in from_json
**kwargs
File "/usr/local/lib/python2.7/dist-packages/wtforms/form.py", line 212, in call
return type.call(cls, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flask_wtf/form.py", line 85, in init
kwargs.setdefault('meta', {}).setdefault('csrf', csrf_enabled)
AttributeError: 'NoneType' object has no attribute 'setdefault'

@alanhamlett
Copy link
Contributor

Looks like a bug in Flask-WTF:

https://github.com/lepture/flask-wtf/issues/new

@virlos
Copy link
Author

virlos commented Jan 10, 2017

Arguably, the definition in WTForms also has meta=None, but it's doc at http://wtforms.readthedocs.io/en/latest/forms.html#wtforms.form.Form.__init__ says: meta – If provided, this is a dictionary of values to override attributes on this form’s meta instance.

@alanhamlett
Copy link
Contributor

You're right, just created #48 to fix this.

@virlos
Copy link
Author

virlos commented Jan 11, 2017

@alanhamlett, it shows as a 'referenced' item here. pallets-eco/flask-wtf#278

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