Code

Opened 7 years ago

Closed 7 years ago

#5046 closed (fixed)

views/debug.py: Display string of UnicodeError

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

Description

Hi,

if you get an UnicodeError in debug.py you don't see
the string, which contains the non utf8 character.

This small patch adds a hint, if the exception is an UnicodeError.
The hint displays some character before and after the wrong
character.

Attachments (2)

views_debug_unicodeerror_hint.diff (1.1 KB) - added by Thomas Güttler <hv@…> 7 years ago.
views_debug_unicodeerror_hint.2.diff (1.1 KB) - added by Thomas Güttler <hv@…> 7 years ago.

Download all attachments as: .zip

Change History (9)

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

comment:1 Changed 7 years ago by jdetaeye@…

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

Ticket #5041 also touches on this problem.

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

I don't see any relation to it:

Ticket #5041 (new)
Admin pages insufficiently escape special characters in primary keys links

I changed views/debug.py to be able to find the source of a unicode
string better by displaying the characters before and after the broken character.

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

  • Component changed from Uncategorized to Metasystem
  • Owner changed from jacob to adrian

comment:4 in reply to: ↑ 3 Changed 7 years ago by anonymous

Replying to Thomas Güttler <hv@tbz-pariv.de>:

Sorry Thomas,

The comment was intended for ticket 5045, not 5046.
My apologies...

Johan

comment:5 Changed 7 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Ready for checkin

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

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

the second diff (views_debug_unicodeerror_hint.2.diff) fixes a typo of
the first diff: smart_unicode(..., errors="replace")

comment:7 Changed 7 years ago by adrian

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

(In [5862]) Fixed #5046 -- Added 'Unicode error hint' section to debug page in the case of a UnicodeError. Thanks, Thomas Guttler

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.