Ticket #5997 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

ReportScreenFilter causes broken HTML on /report page

Reported by: rstoki ~~at~~ seznam ~~ cz Assigned to: 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

Change History

(follow-up: ↓ 2 ) 10/21/09 20:16:24 changed 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.

(in reply to: ↑ 1 ) 10/21/09 21:53:56 changed 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:

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.

(follow-up: ↓ 4 ) 10/21/09 22:26:55 changed 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

(in reply to: ↑ 3 ) 10/21/09 22:40:22 changed 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

10/21/09 23:51:03 changed by bobbysmith007

  • status changed from new to closed.
  • resolution set to fixed.

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

10/22/09 00:09:08 changed by bobbysmith007

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

10/22/09 16:47:37 changed 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/Change #5997 (ReportScreenFilter causes broken HTML on /report page)




Change Properties
Action