Opened 5 years ago

Closed 5 years ago

#24710 closed Bug (wontfix)

Replace BaseForm.errors property with get_errors method

Reported by: Artem Rizhov Owned by: nobody
Component: Forms Version: 1.7
Severity: Normal Keywords:
Cc: artem.rizhov@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Artem Rizhov)

This is not a real bug, but it makes some problems. Some kind of Schrödinger's bug.

I think property getter should not do so much changes into the internal state of the object. This getter calls the full_clean method, so this is actually not a getter, but a real worker.

This also produces very annoying side effects on debugging which really look and work like a bug. Please see this stackoverflow question for example
http://stackoverflow.com/questions/12142819/debugging-form-validation-in-pycharm
(sorry for the link to third-party resource, please let me know if you think this text should be copied here)

I propose to replace errors property with get_errors method so that

  • anybody can see it does some work to retrieve the errors
  • debuggers do not try to evaluate it
  • developers do not spend hours for catching non-existent bugs in their apps :)

Change History (2)

comment:1 Changed 5 years ago by Artem Rizhov

Description: modified (diff)

comment:2 Changed 5 years ago by Tim Graham

Resolution: wontfix
Status: newclosed

Thanks for the suggestion. While I agree the current situation may not be ideal, I think changing from a property to a method at this at this point in Django's history would be a rather large disruption with the benefits not exceeding the costs. If you want to continue the discussion please use the DevelopersMailingList.

Note: See TracTickets for help on using tickets.
Back to Top