Edgewall Software
Modify

#13046 closed defect (fixed)

ParseError: duplicate attribute: line 281, column 33 - when rendering simple report

Reported by: trac@… Owned by: Jun Omae
Priority: normal Milestone: 1.3.3
Component: report system Version: 1.3.2
Severity: normal Keywords: genshi
Cc: Branch:
Release Notes:

Fix malformed html when the column ended with _ is used in report.

API Changes:

Description (last modified by anonymous)

How to Reproduce

While doing a GET operation on /report/301, Trac issued an internal error.

The report definition follows (output should be just one line):

SELECT 'Weekly Timesheet for ' || 'XXX' || ' ending on ' || DATE(2458286) AS __group__, 0 AS _mainOrd, 
       '' AS activity, '' AS client, 'Date:' AS ticket, 
       strftime('%m/%d', DATE(2458286, '-6 days')) AS SUN,
       NULL AS WeekTotal, -1 AS _ord, NULL AS __color__, 'font-weight: bold;' AS __style__,
       NULL AS _comment_

Problem seems to be the _comment_ column on output. (Also please note the Ticket column contains text in this case.)

Request parameters:

{'id': u'301'}

User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36

System Information

Trac 1.3.2
Babel 2.6.0
Genshi 0.7 (without speedups)
Jinja2 2.10
pysqlite 2.6.0
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
pytz 2018.4
setuptools 39.2.0
SQLite 3.14.2
jQuery 1.12.4
jQuery UI 1.12.1
jQuery Timepicker 1.6.3

Enabled Plugins

timingandestimationplugin 1.5.9
traccustomfieldadmin 0.2.13
tracmastertickets 4.0.2
tracsubticketsplugin 0.5.3

Interface Customization

shared-htdocs
shared-templates
site-htdocs malotraccloud3.jpg
site-templates

Python Traceback

Traceback (most recent call last):
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\main.py", line 640, in _dispatch_request
    dispatcher.dispatch(req)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\main.py", line 263, in dispatch
    method=method)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\chrome.py", line 1418, in render_template
    fragment, iterable, method)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\chrome.py", line 1480, in _render_jinja_template
    iterable)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\chrome.py", line 1911, in _filter_jinja_page
    stream = XML(content)
  File "build\bdist.win-amd64\egg\genshi\input.py", line 275, in XML
    return Stream(list(XMLParser(StringIO(text))))
  File "build\bdist.win-amd64\egg\genshi\core.py", line 289, in _ensure
    for event in stream:
  File "build\bdist.win-amd64\egg\genshi\input.py", line 449, in _coalesce
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "build\bdist.win-amd64\egg\genshi\input.py", line 169, in _generate
    raise ParseError(msg, self.filename, e.lineno, e.offset)
ParseError: duplicate attribute: line 281, column 33

Attachments (0)

Change History (8)

comment:1 by anonymous, 14 months ago

Description: modified (diff)

comment:2 by Jun Omae, 14 months ago

Component: renderingreport system
Priority: highnormal

comment:3 by Jun Omae, 14 months ago

The duplicate attribute has been fixed in #12919.

            <td class="comment"  class="fullrow" colspan="100">

However, tr tags are not balanced.

Line 
216 <tbody>
217 <tr class="color-even" style="font-weight: bold;">
218 <td class="activity">
219 </td>
220 <td class="client">
221 </td>
222 <td class="ticket">
223 <a title="View ticket"
224 href="/tracenv/ticket/Date%3A">#Date:</a>
225 </td>
226 <td class="SUN">06/10
227 </td>
228 <td class="WeekTotal">
229 </td>
230 <tr class="color-even" style="font-weight: bold;; border: none; padding: 0">
231 <td class="fullrow comment" colspan="100">
232<hr /> </td>
233 <tr class="color-even" style="font-weight: bold;">
234 </tr>
235 </tbody>

comment:4 by Jun Omae, 14 months ago

Work around is to disable all plugins.

comment:5 by Jun Omae, 14 months ago

Keywords: genshi added
Milestone: next-dev-1.3.x1.3.3
Owner: set to Jun Omae
Status: newassigned

Proposed changes in [c730bb6b7/jomae.git] (jomae.git@t13046).

comment:6 by Ryan J Ollos, 14 months ago

Looks good. The unit test may just need minor modification:

  • trac/ticket/tests/report.py

    diff --git a/trac/ticket/tests/report.py b/trac/ticket/tests/report.py
    index 986325711..fddb470f3 100644
    a b class ReportModuleTestCase(unittest.TestCase):  
    369369        self.assertNotIn('query_tickets', req.session)
    370370
    371371    def test_valid_html_for_report(self):
    372         req = MockRequest(self.env, method='POST', args={
     372        req = MockRequest(self.env, method='POST', path_info='/report', args={
    373373            'action': 'new',
    374374            'title': '#13046',
    375375            'query': "SELECT '#13046' AS foo_, 42 AS bar, 'blah' AS _baz_",
    376376            'description': ''})
    377         self.assertTrue(self.report_module.match_request, req)
     377        self.assertTrue(self.report_module.match_request(req))
    378378        self.assertRaises(RequestDone, self.report_module.process_request, req)
    379379
    380380        req = MockRequest(self.env, method='GET', path_info='/report/9')

comment:7 by Jun Omae, 14 months ago

Thanks for the reviewing. Updated jomae.git@t13046. In addition, when Genshi is not available, skips only XML validation rather than test_valid_html_for_report.

  • trac/ticket/tests/report.py

    diff --git a/trac/ticket/tests/report.py b/trac/ticket/tests/report.py
    index fddb470f3..f2468eb71 100644
    a b class ReportModuleTestCase(unittest.TestCase):  
    395395                                 r'<tr[^>]*>\s*'
    396396                                 r'<td class="fullrow baz" colspan="100">'
    397397                                 r'\s*blah\s*<hr />\s*</td>\s*</tr>')
    398         XML(rendered)  # validates as XML
    399 
    400     if not genshi:
    401         del test_valid_html_for_report
     398        if genshi:
     399            XML(rendered)  # validates as XML
    402400

comment:8 by Jun Omae, 14 months ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [16673].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.