Code

Opened 7 years ago

Closed 7 years ago

#4387 closed (invalid)

newforms: ErrorDict.as_ul() needs to handle a list of errors

Reported by: Thomas Güttler <hv@…> Owned by: adrian
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hi,

ErrorDict.as_ul() did not handle its dictionary if errors
as a list.

This patch does this. I gues this code gets only called if
you use "print myerrordict" for debugging.

Attachments (1)

newformsutils-printerrordict.diff (778 bytes) - added by Thomas Güttler <hv@…> 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by Thomas Güttler <hv@…>

comment:1 Changed 7 years ago by Gary Wilson <gary.wilson@…>

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 7 years ago by mtredinnick

  • Needs tests unset
  • Triage Stage changed from Accepted to Unreviewed

This patch doesn't make sense. For a start, it doesn't pass the tests. More importantly, it doesn't seem necessary.

ErrorDict is only ever populated by ValidationError.messages, which are all ErrorList instances and ErrorList knows how to print itself. How are you getting into a situation where this is not the case?

comment:3 Changed 7 years ago by Thomas Güttler <hv@…>

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

Yes, this path is not necessary. I tried to write a ErrorDict to stout (for debugging: print myform.errors).
This resulted in a UnicodeError. Since as_text() loops over each value of the dict, I thought it would
be necessary for as_ul(), too. But the real problem is that writing to stout for debugging
does not handle unicode.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.