Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#3088 closed defect (fixed)

to_unicode() special casing Exception

Reported by: Alec Thomas Owned by: Christian Boos
Priority: normal Milestone: 0.10
Component: general Version: devel
Severity: minor Keywords: unicode exceptions
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Should this be handled as it is? It completely ignores the __str__() method of the Exception subclass. In the case of the Permission exception, the user receives an empty red box.

The following patch seems to work fine in the limited cases I've tested, but I didn't commit it because I might not be aware of cases where it doesn't.

  • trac/util/__init__.py

     
    9191    the input).
    9292    """
    9393    if not isinstance(text, str):
    94         if isinstance(text, Exception):
    95             return ' '.join([unicode(arg) for arg in text.args])
    9694        return unicode(text)
    9795    errors = lossy and 'replace' or 'strict'
    9896    try:

Attachments (0)

Change History (2)

comment:1 by Christian Boos, 19 years ago

Owner: changed from Jonas Borgström to Christian Boos

svn blame is your friend… More specifically, I did that in order to fix a problem with parse_date. I'll try to come up with a better solution which also takes care of the new problem you mentionned.

comment:2 by Christian Boos, 19 years ago

Resolution: fixed
Severity: normalminor
Status: newclosed

No wonder you could remove the check, the unit test I added in r3215 was completely broken… I fixed that in r3255, as well as adding a fix and a test for the error you reported.

(Note: I'm directly committing the fix and closing the issue instead of first attaching a patch here, as I've noticed that the e-mail notifications are currently not working, last message sent: Fri Apr 28 22:35:20 CDT 2006).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.