Opened 17 years ago
Closed 16 years ago
#5981 closed defect (fixed)
TracException should have `__unicode__()` method for non ASCII message
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11.1 |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | i18n unicode |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
While playing with i18n branch, there's a problem to raise
exception with translated message.
TracException
class should have __unicode__()
method to
use non-ASCII exception message. Otherwise, we will get UnicodeEncodeError
.
(Ex., see changeset.py line 878)
-
trac/core.py
diff -r c0a1d13079de trac/core.py
a b class TracError(Exception): 37 37 if title: 38 38 self.title = title 39 39 self.show_traceback = show_traceback 40 41 def __unicode__(self): 42 return unicode(self.message) 40 43 41 44 42 45 class Interface(object):
This issue is realized on i18n branch code, but 0.11-dev trunk code has also.
Attachments (0)
Change History (5)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Keywords: | unicode added |
---|---|
Milestone: | → 0.11.1 |
Owner: | changed from | to
Well, this unicode(self.message)
won't work if self.message
itself is not already convertible to unicode, but I guess that would be yet another problem.
So actually the patch looks good.
comment:3 by , 17 years ago
Committed in r6984 (on the i18n branch as well, where the reporter discovered the issue and where I was able to reproduce it).
Should land on trunk when the branch gets merged.
I think it can be backported to 0.11-stable as well.
comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Committed as [7397] on 0.11-stable. Thanks for the patch!
I second this—I just ran into the same problem. It's an easy fix, and should be included in 0.11.