Skip to content

Commit

Permalink
Clarify the form.csrf_enabled deprecation warning
Browse files Browse the repository at this point in the history
It was speaking about meta.csrf which is pretty much unclear :

- what is this `meta` ?
- suggests that `csrf` is an attribute of `meta` (which is wrong: it is a dict
  key)
  • Loading branch information
JocelynDelalande committed Mar 29, 2017
1 parent c3e4d55 commit a919882
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flask_wtf/form.py
Expand Up @@ -79,7 +79,7 @@ def __init__(self, formdata=_Auto, **kwargs):
if csrf_enabled is not None:
warnings.warn(FlaskWTFDeprecationWarning(
'"csrf_enabled" is deprecated and will be removed in 1.0. '
'Set "meta.csrf" instead.'
'Pass the "meta" dict arg with a "csrf" key instead.'
), stacklevel=3)
kwargs['meta'] = kwargs.get('meta') or {}
kwargs['meta'].setdefault('csrf', csrf_enabled)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_form.py
Expand Up @@ -132,4 +132,4 @@ class F(FlaskForm):

F(csrf_enabled=False)
w = recwarn.pop(FlaskWTFDeprecationWarning)
assert 'meta.csrf' in str(w.message)
assert '"csrf" key' in str(w.message)

0 comments on commit a919882

Please sign in to comment.