Opened 18 years ago
Closed 18 years ago
#5066 closed defect (fixed)
Trac fails to handle Markup'ed exception message
Reported by: | Emmanuel Blot | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | python25 |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When a internal error signalled with TracError(Markup(...))
is raised, the error message is not rendered as HTML (see attached file).
(There are only 3 remaining locations where this syntax is used in the current trunk)
Attachments (1)
Change History (11)
by , 18 years ago
Attachment: | internalerror.png added |
---|
follow-up: 2 comment:1 by , 18 years ago
Milestone: | → 0.11 |
---|
Strange, I can't reproduce this error, for me the generated HTML is correct.
One difference I can see between my error page and yours is that I have an <h1> of "Internal Error" and you have "Internal Server Error".
Which Python version are you using? (I'm using 2.4.2)
comment:2 by , 18 years ago
Replying to cboos:
Which Python version are you using? (I'm using 2.4.2)
For 0.11dev, I'm using Python 2.5, Clearsilver not being installed if that (still) matters.
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
comment:3 by , 18 years ago
Keywords: | python2.5 added |
---|
(anonymous was me)
You're right: I gave a try with Python 2.4 (w/ Clearsilver available), and it works as expected. This is a Python 2.5 -only issue.
follow-up: 5 comment:4 by , 18 years ago
Keywords: | python25 added; python2.5 removed |
---|
Also noticed that the <title> for error pages having Markup error message will actually contain the tags (e.g. No node /zxy, at revision 89<br><p>You may… etc.).
Also, the TracError's title is not used, we should catch directly TracErrors instead of going through a HTTPInternalError.
comment:5 by , 18 years ago
follow-ups: 7 9 comment:6 by , 18 years ago
Keywords: | python25 removed |
---|
#4896 was related to this bug: it helped to understand (partially) what's going on here.
It seems that for some reason, the HTTPException is not caught in the except HTTPException
block, but in the next one, except Exception
. There, the exception gets stringified into a non-markup string and gets escaped.
comment:8 by , 18 years ago
Priority: | low → normal |
---|---|
Severity: | minor → normal |
comment:9 by , 18 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
It seems that for some reason, the HTTPException is not caught in the
except HTTPException
block, but in the next one,except Exception
. There, the exception gets stringified into a non-markup string and gets escaped.
Fortunately that's not the case, the exceptions are caught normally. What happens is that Python 2.5 introduced a new root class for the exception class hierarchy (BaseException
) and that class defines a .message
property which overwrites our own .message
field. Therefore, the Markup content set for that field gets replaced by the stringified message.
Internal error exhibits raw HTML code