Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5997 closed defect (fixed)

ReportScreenFilter causes broken HTML on /report page

Reported by: rstoki ~~at~~ seznam ~~ cz Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: major Keywords: ReportScreenFilter
Cc: Trac Release: 0.11

Description

I have installed 'timingandestimationplugin 0.8.1' globbaly for Trac 0.11.5 installation (using command easy_install http://trac-hacks.org/svn/timingandestimationplugin/branches/trac0.11-Permissions/)(20.10.2010 - Revision 6773).

It seems like the component ReportScreenFilter causes, that /report page is broken - in particular, the closing tag </h1> for heading is not printed (after text "Available Reports").

    <div id="content" class="report">
      <h1>Available Reports
      <div id="description">
        <p>
This is a list of available reports.
</p>

This leads to invalid XHTML document and also the formatting is wrong (because all following HTML elements are supposed to be inside <h1> element.

When I disable ReportScreenFilter, everything is OK (/report page looks normally).

Attachments (0)

Change History (7)

comment:1 follow-up: Changed 5 years ago by bobbysmith007

Running what seems to be similar versions of the plugin and trac I get:

<div id="content" class="report">
      <h1>Available Reports
      </h1>
      <div id="description">
        <p>
This is a list of available reports.
</p>

  • Do you have any other plugins installed that this might be conflicting with TandE?
  • Do you have any customizations to your trac templates that could be conflicting with TandE?
  • If you look at the trac template /trac/ticket/templates/report_view.html, do you see the closing h1 tag?
    • this can be found by looking (on my install) in /usr/local/lib/python2.6/dist-packages/timingandestimationplugin-0.8.1-py2.6.egg (which may need to be unzipped)
    • if you have specified a shared template directory then you will need to look in there

This should basically be impossible (not that I disbelieve) because the modifications that the filter makes are via xpath/Genshi templates which theoretically operate only on valid xml streams.

I will try to figure out whats happening further when I get the answers to these questions.

comment:2 in reply to: ↑ 1 Changed 5 years ago by rstoki

Replying to bobbysmith007:

  • Do you have any other plugins installed that this might be conflicting with TandE?

I have installed and enabled the following plugins:

  • EstimationTools 0.4
  • TracDiscussion 0.7-r6310
  • TracXMLRPC 1.0.6
  • estimatorplugin 0.1.1
  • timingandestimationplugin 0.8.1

Just a note - I think, that I have discovered the issue before installation plugins "EstimationTools" and "estimatorplugin".


  • Do you have any customizations to your trac templates that could be conflicting with TandE?

No, I haven't change anything in Trac templates (I use the default ones).


  • If you look at the trac template /trac/ticket/templates/report_view.html, do you see the closing h1 tag?

This mentioned template is physically located in /usr/share/pyshared/trac/ticket/templates/report_view.html on my system (it is Debian distribution) and also symlinked from /usr/lib/python2.5/site-packages/trac/ticket/templates/report_view.html). But it looks pretty fine:

  <body>
    <div id="content" class="report">

      <h1>$title
        <span py:if="numrows and report.id != -1" class="numrows">($numrows matches)</span>
      </h1>

      <div py:if="description" id="description" xml:space="preserve">
        ${wiki_to_html(context, description)}
      </div>
    ... 


This should basically be impossible (not that I disbelieve) because the modifications that the filter makes are via xpath/Genshi templates which theoretically operate only on valid xml streams.

Just some remarks on this template - when I was hunting this issue, I have tried to modify this template. My modifications have been visible on web, so it has been proven, that this template is really actively used. Moreover, I have realized, that if this template is invalid, Python will throw some exception :) (TemplateSyntaxError: mismatched tag: ...).

Also, I have tried to 'move' the closing H1 tag on various lines (where I will not break the XML structure) and tested it for page with and without some ($numrows matches) value (page /report and /report/1). I got this results:

Template variant:

      <h1>$title
        <span py:if="numrows and report.id != -1" class="numrows">($numrows matches)</span>

      </h1><div py:if="description" id="description" xml:space="preserve">

-- broken in both pages /report and /report/1, will generate:

<div id="content" class="report">
      <h1>Available Reports
      <div id="description">

and

    <div id="content" class="report">
      <h1>{1} Active Tickets
        (2 matches)</span>
      <div id="description">

Please, note the missing opening tag <span> too!


Template variant:

      <h1>$title
        <span py:if="numrows and report.id != -1" class="numrows">($numrows matches)</span></h1>

-- broken in /report, OKAY in /report/1 (H1 is okay, but SPAN is broken) - will generate:

    <div id="content" class="report">
      <h1>Available Reports
      <div id="description">

and

    <div id="content" class="report">
      <h1>{1} Active Tickets
        (2 matches)</span></h1>
      <div id="description">

Template variant:

      <h1>$title</h1>
        <span py:if="numrows and report.id != -1" class="numrows">($numrows matches)</span>

-- broken in both pages, will generate:

    <div id="content" class="report">
      <h1>Available Reports
      <div id="description">

and

    <div id="content" class="report">
      <h1>{1} Active Tickets
        <span class="numrows">(2 matches)</span>
      <div id="description">

(please note, that SPAN is here okay, byt H1 is broken).


BUT, when I have change H1 tag to H2, all mentioned variants generates valid output! For example the last variant will generate:

    <div id="content" class="report">
      <h2>Available Reports</h2>
      <div id="description">

and

    <div id="content" class="report">
      <h2>{1} Active Tickets</h2>
        <span class="numrows">(2 matches)</span>
      <div id="description">

and for the 'default' position of tags (just substituted H1 to H2), I got following generated HTML:

    <div id="content" class="report">
      <h2>Available Reports
      </h2>
      <div id="description">

and

    <div id="content" class="report">
      <h2>{1} Active Tickets
        <span class="numrows">(2 matches)</span>
      </h2>
      <div id="description">

Really strange behavior for me, but I hope it will help you to find the problem.

Just one additional note: I have noticed your location python2.6, so I checked my Python version - and I have Python 2.5.4. I dont' know, if it can provide you some clue...


I will try to figure out whats happening further when I get the answers to these questions.

Please, let me know on my email, if you have any other question, or if I can provide you some additional information.

comment:3 follow-up: Changed 5 years ago by bobbysmith007

  • Which genshi version you are using?
    • This should be available on the about trac screen (/about).
    • The error could be a genshi bug. Once I track down whats happening, if it is a genshi bug, I will open a ticket and point them at your analysis.

This is my system info in case it helps you spot anything else:

Trac:		0.11.6stable-r8458
Python:		2.6.2 (release26-maint, Apr 19 2009, 02:15:38) [GCC 4.3.3]
setuptools:	0.6c9
psycopg2:	2.0.8
Genshi:		0.5.1
mod_python:	3.3.1
GIT:		1.6.0.4
jQuery:		1.2.6

I will look at the filter scripts while changing the templates in the way that you suggested.

Thanks for the extremely helpful analysis.

Russ

comment:4 in reply to: ↑ 3 Changed 5 years ago by anonymous

Replying to bobbysmith007:

My system information:

Trac:	        0.11.5
Python: 	2.5.4 (r254:67916, Sep 26 2009, 08:18:06) [GCC 4.3.4]
setuptools:	0.6c9
SQLite: 	3.3.7
pysqlite:	2.5.5
Genshi: 	0.5.1
mod_python:	3.3.1
Subversion:	1.6.3 (r38063)
RPC:		1.0.6
jQuery:		1.3.2

comment:5 Changed 5 years ago by bobbysmith007

  • Resolution set to fixed
  • Status changed from new to closed

(In [6790]) fixed #5997 found what seems to be a bug in Transformer.filter, added a new FilterTransformation and apply that instead

comment:6 Changed 5 years ago by bobbysmith007

Heres the genshi bug report: http://genshi.edgewall.org/ticket/341

comment:7 Changed 5 years ago by bobbysmith007

If you upgrade genshi past r1000 you should not experience the bug. (But I also made TandE use an alternate implementation so that it would still work regardless of genshi version)

Add Comment

Modify Ticket

Action
as closed The owner will remain bobbysmith007.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.