Edgewall Software
Modify

Opened 16 years ago

Closed 16 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)

internalerror.png (43.8 KB ) - added by Emmanuel Blot 16 years ago.
Internal error exhibits raw HTML code

Download all attachments as: .zip

Change History (11)

by Emmanuel Blot, 16 years ago

Attachment: internalerror.png added

Internal error exhibits raw HTML code

comment:1 by Christian Boos, 16 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)

in reply to:  1 comment:2 by anonymous, 16 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 Emmanuel Blot, 16 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.

comment:4 by Christian Boos, 16 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.

in reply to:  4 comment:5 by Christian Boos, 16 years ago

Follow-up to comment:4:

Also, the TracError's title is not used, we should catch directly TracErrors instead of going through a HTTPInternalError.

… or alternatively propagate the TracError.title to the HTTPInternalError.reason, see r5189.

comment:6 by anonymous, 16 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.

in reply to:  6 comment:7 by Christian Boos, 16 years ago

Keywords: python25 added

anonymous: (was me)

comment:8 by Christian Boos, 16 years ago

Priority: lownormal
Severity: minornormal

in reply to:  6 comment:9 by Christian Boos, 16 years ago

Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

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.

comment:10 by Christian Boos, 16 years ago

Resolution: fixed
Status: assignedclosed

Fixed by r5395.

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.