Skip to content

Form-level errors#595

Merged
azmeuk merged 2 commits into
pallets-eco:masterfrom
azmeuk:issue-55-form-wise-errors
May 28, 2020
Merged

Form-level errors#595
azmeuk merged 2 commits into
pallets-eco:masterfrom
azmeuk:issue-55-form-wise-errors

Conversation

@azmeuk
Copy link
Copy Markdown
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
Copy Markdown
Member

I like None more.

Comment thread docs/forms.rst Outdated
@azmeuk azmeuk force-pushed the issue-55-form-wise-errors branch from 769baf1 to 63b40d2 Compare April 24, 2020 19:15
Comment thread docs/forms.rst Outdated
@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
Copy Markdown

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