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

Form-level errors #595

Merged
merged 2 commits into from
May 28, 2020
Merged

Conversation

azmeuk
Copy link
Member

@azmeuk azmeuk commented Apr 24, 2020

Fixes #55

Adds a Form.form_errors list attribute to store form level errors. The content of form_errors is available in Form.errors[None].

I have no strong ideas about Form.errors[None], or Form.errors["__all__"], even if I prefer a keyword such as None for such a special key. __all__ is fine too if you prefer.

@azmeuk azmeuk added the enhancement New feature, or existing feature improvement label Apr 24, 2020
@azmeuk azmeuk added this to the 3.0 milestone Apr 24, 2020
@davidism
Copy link
Member

I like None more.

docs/forms.rst Outdated Show resolved Hide resolved
docs/forms.rst Outdated Show resolved Hide resolved
@azmeuk azmeuk force-pushed the issue-55-form-wise-errors branch from 63b40d2 to 22636b5 Compare May 28, 2020 16:37
@azmeuk azmeuk merged commit 12020ba into pallets-eco:master May 28, 2020
@oTree-org
Copy link

oTree-org commented Mar 5, 2021

Hi, I am using wtforms in my project (thank you by the way) and just wanted to comment on this, even though it may be too late. I actually think '__all__' is a nice name because:

  • It is a string, like all the other keys in the dict. This gives the dict a simpler type signature.
  • '__all__' is something recognizable and searchable. I can search my codebase and the WTForms docs for '__all__' to get more info about it and where it is used, but None is hard to search for. Some people might see None and not know what it means.
  • This is what Django uses, so many people know it by convention.

Just my 2 cents but I don't have a strong opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, or existing feature improvement
Development

Successfully merging this pull request may close these issues.

[feature request/question] Form wise errors
3 participants