Incorrect HTML generated by HTMLExceptionFormatter

Bug #351006 reported by Jayden Kneller
2
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Undecided
Tres Seaver

Bug Description

Currently HTMLExceptionFormatter wraps a <p> tag around a <ul> tag.

According to w3.org (http://www.w3.org/TR/html401/struct/text.html#h-9.3.1):
The P element represents a paragraph. It cannot contain block-level elements (including P itself).

In (http://www.w3.org/TR/html401/sgml/loosedtd.html) under (HTML content models) it mentions:
%block; block-like elements e.g. paragraphs and lists

Therefore <p> and <ul> tags are both block level. So a <p> tag cannot wrap around a <ul> tag.

So instead of the current code:
def getPrefix(self):
    return '<p>Traceback (innermost last):\r\n<ul>'

def formatLastLine(self, exc_line):
    return '</ul>%s</p>' % self.escape(exc_line)

To fix this we need the follow:
def getPrefix(self):
    return '<p>Traceback (innermost last):</p>\r\n<ul>'

def formatLastLine(self, exc_line):
    return '</ul><p>%s</p>' % self.escape(exc_line)

Basically a </p> is added before the open \r\n<ul> in getPrefix and <p> is added after </ul> in formatLastLine.

This fixes the html so it is correct.

Revision history for this message
Jayden Kneller (webmaster-pendulumdreams) wrote :
Revision history for this message
Tres Seaver (tseaver) wrote :

Thanks very much for the patch. Applied to the Zope 2.12 branch:

  http://svn.zope.org/Zope/branches/2.12/?rev=112182&view=rev

and to the trunk:

  http://svn.zope.org/Zope/trunk/?rev=112183&view=rev

Changed in zope2:
assignee: nobody → Tres Seaver (tseaver)
status: New → Fix Committed
Tres Seaver (tseaver)
Changed in zope2:
milestone: none → 2.12.5
Changed in zope2:
milestone: 2.12.5 → 2.12.6
Tres Seaver (tseaver)
Changed in zope2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.