#13046 closed defect (fixed)
ParseError: duplicate attribute: line 281, column 33 - when rendering simple report
| Reported by: | 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: | |||
| API Changes: | |||
| Internal Changes: |
Fix malformed html when the column ended with |
||
Description (last modified by )
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 (9)
comment:1 by , 7 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 7 years ago
| Component: | rendering → report system |
|---|---|
| Priority: | high → normal |
comment:3 by , 7 years ago
comment:5 by , 7 years ago
| Keywords: | genshi added |
|---|---|
| Milestone: | next-dev-1.3.x → 1.3.3 |
| Owner: | set to |
| Status: | new → assigned |
Proposed changes in [c730bb6b7/jomae.git] (jomae.git@t13046).
comment:6 by , 7 years 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): 369 369 self.assertNotIn('query_tickets', req.session) 370 370 371 371 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={ 373 373 'action': 'new', 374 374 'title': '#13046', 375 375 'query': "SELECT '#13046' AS foo_, 42 AS bar, 'blah' AS _baz_", 376 376 'description': ''}) 377 self.assertTrue(self.report_module.match_request , req)377 self.assertTrue(self.report_module.match_request(req)) 378 378 self.assertRaises(RequestDone, self.report_module.process_request, req) 379 379 380 380 req = MockRequest(self.env, method='GET', path_info='/report/9')
comment:7 by , 7 years 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): 395 395 r'<tr[^>]*>\s*' 396 396 r'<td class="fullrow baz" colspan="100">' 397 397 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 402 400
comment:8 by , 7 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Fixed in [16673].



The duplicate attribute has been fixed in #12919.
However,
trtags are not balanced.