Opened 7 years ago

Closed 6 years ago

Last modified 3 years ago

#6675 closed Uncategorized (wontfix)

Better error message if cleaned_data is missing (unbound Form)

Reported by: guettli Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Up to now cleaned_data gets added and removed from forms. For people new to django,
it would be nice to have a better error message:

Old:

AttributeError: 'Person' object has no attribute 'cleaned_data'

New:

<MyForm object at 0x55555647c890>: Unbound Fields have no cleaned_data attribute

Patch incl. modification of unittest attached.

Attachments (1)

newforms_better_error_message_if_unbound.diff (3.0 KB) - added by guettli 7 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 7 years ago by guettli

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Better patch. Access to 'errors' was disabled by first patch.

comment:2 Changed 7 years ago by programmerq

  • Triage Stage changed from Unreviewed to Accepted

+1 This would help make troubleshooting more clear.

comment:3 Changed 6 years ago by SmileyChris

  • Resolution set to wontfix
  • Status changed from new to closed

That message is even more confusing, since we're talking about a Form not a Field.

Also, this patch is stopping attribute access to forms, which is completely backwards incompatible.

comment:4 Changed 6 years ago by guettli

Yes, SmileyChris, this was a typo. The *Form* is unbound.

Nevertheless disappearing attributes are bad. But I don't now a better patch.

comment:5 Changed 3 years ago by guettli

  • Cc hv@… removed
  • Easy pickings unset
  • Severity set to Normal
  • Type set to Uncategorized
  • UI/UX unset

Related https://code.djangoproject.com/ticket/5524 (stop cleaned_data from disappearing).

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