#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
91 91 the input). 92 92 """ 93 93 if not isinstance(text, str): 94 if isinstance(text, Exception):95 return ' '.join([unicode(arg) for arg in text.args])96 94 return unicode(text) 97 95 errors = lossy and 'replace' or 'strict' 98 96 try:
Attachments (0)
Change History (2)
comment:1 by , 20 years ago
| Owner: | changed from to |
|---|
comment:2 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Severity: | normal → minor |
| Status: | new → closed |
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).



svn blameis 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.