Opened 15 years ago
Closed 5 years ago
#7185 closed enhancement (wontfix)
[PATCH] Improve "id" field handling in reports
Reported by: | Matthijs Kooijman | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | BlackMagicTicketTweaksPlugin |
Severity: | normal | Keywords: | patch |
Cc: | Ivanelson Nunes | Trac Release: | 0.11 |
Description
The plugin incorrectly assumes that there will be a field "id" in each row of the report view. Also, it assumes that the "id" field references a ticket, while it may reference other things (like reports. commits, wikipages) through the setting of the "realm" field. Finally, there is the "ticket" field, which can also contain the ticket id. See http://trac.edgewall.org/wiki/TracReports#Automaticallyformattedcolumns for details.
The attached patch fixes all three of these issues. Note that it resorts to not applying access control when no id field is present or it does not reference a ticket, since then it cannot know which ticket is being displayed.
Attachments (1)
Change History (10)
Changed 15 years ago by
Attachment: | optional-id.patch added |
---|
comment:1 Changed 15 years ago by
Note that the patch looks big, but everything after if id:
is only indented one level, no other changes.
comment:2 Changed 12 years ago by
Cc: | Ivanelson Nunes added; anonymous removed |
---|---|
Owner: | changed from obs to Ryan J Ollos |
Status: | new → assigned |
#11140 closed as a duplicate.
comment:4 follow-up: 5 Changed 12 years ago by
ivanelson: I wasn't able to add your report from comment:2:ticket:11140 without seeing errors. Which database are you using? I expect more changes may be needed after [13282], but please do some testing and report back.
comment:5 follow-up: 6 Changed 12 years ago by
Replying to rjollos:
ivanelson: I wasn't able to add your report from comment:2:ticket:11140 without seeing errors. Which database are you using? I expect more changes may be needed after [13282], but please do some testing and report back.
I am using Postgres. The error has changed:
2013-06-11 23:53:30,100 Trac[main] ERROR: Internal Server Error: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.py", line 497, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.py", line 233, in dispatch content_type) File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/chrome.py", line 1000, in render_template encoding='utf-8') File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 183, in render return encode(generator, method=method, encoding=encoding, out=out) File "/usr/lib/python2.7/dist-packages/genshi/output.py", line 58, in encode for chunk in iterator: File "/usr/lib/python2.7/dist-packages/genshi/output.py", line 339, in __call__ for kind, data, pos in stream: File "/usr/lib/python2.7/dist-packages/genshi/output.py", line 826, in __call__ for kind, data, pos in stream: File "/usr/lib/python2.7/dist-packages/genshi/output.py", line 670, in __call__ for kind, data, pos in stream: File "/usr/lib/python2.7/dist-packages/genshi/output.py", line 771, in __call__ for kind, data, pos in chain(stream, [(None, None, None)]): File "/usr/lib/python2.7/dist-packages/genshi/output.py", line 586, in __call__ for ev in stream: File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 288, in _ensure for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 288, in _ensure for event in stream: File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/chrome.py", line 1137, in _strip_accesskeys for kind, data, pos in stream: File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 288, in _ensure for event in stream: File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/chrome.py", line 1126, in _generate for kind, data, pos in stream: File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 288, in _ensure for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 288, in _ensure for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/filters/transform.py", line 686, in _unmark for mark, event in stream: File "/usr/lib/python2.7/dist-packages/genshi/filters/transform.py", line 906, in __call__ for mark, event in stream: File "/usr/lib/python2.7/dist-packages/genshi/filters/transform.py", line 714, in __call__ for mark, event in stream: File "/usr/lib/python2.7/dist-packages/genshi/filters/transform.py", line 682, in _mark for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 605, in _include for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/template/markup.py", line 378, in _match ctxt, start=idx + 1, **vars): File "/usr/lib/python2.7/dist-packages/genshi/template/markup.py", line 378, in _match ctxt, start=idx + 1, **vars): File "/usr/lib/python2.7/dist-packages/genshi/template/markup.py", line 362, in _match content = list(content) File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 605, in _include for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/template/markup.py", line 327, in _match for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/template/markup.py", line 316, in _strip event = next() File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 545, in _flatten for kind, data, pos in stream: File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 288, in _ensure for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/path.py", line 588, in _generate subevent = next() File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 605, in _include for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/template/markup.py", line 316, in _strip event = next() File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 545, in _flatten for kind, data, pos in stream: File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 288, in _ensure for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/path.py", line 588, in _generate subevent = next() File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 605, in _include for event in stream: File "/usr/lib/python2.7/dist-packages/genshi/template/markup.py", line 316, in _strip event = next() File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 565, in _flatten result = _eval_expr(data, ctxt, vars) File "/usr/lib/python2.7/dist-packages/genshi/template/base.py", line 277, in _eval_expr retval = expr.evaluate(ctxt) File "/usr/lib/python2.7/dist-packages/genshi/template/eval.py", line 178, in evaluate return eval(self.code, _globals, {'__data__': data}) File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/ticket/templates/report_view.html", line 165, in <Expression u"format_date(from_utimestamp(long(cell.value))) if cell.value != '' else '--'"> <td class="date" py:attrs="td_attrs">${format_date(from_utimestamp(long(cell.value))) if cell.value != '' else '--'} ValueError: invalid literal for long() with base 10: '24/08/2012'
comment:6 follow-up: 7 Changed 12 years ago by
Replying to ivanelson:
I am using Postgres. The error has changed:
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/ticket/templates/report_view.html", line 165, in <Expression u"format_date(from_utimestamp(long(cell.value))) if cell.value != '' else '--'"> <td class="date" py:attrs="td_attrs">${format_date(from_utimestamp(long(cell.value))) if cell.value != '' else '--'} ValueError: invalid literal for long() with base 10: '24/08/2012'
That is your SQL has the issue in TracReports, not the plugin.
Also, the following in your SQL
to_char(to_timestamp(t.time/1000000),'DD/MM/YYYY') AS Created,
should be
t.time AS Created,
comment:7 Changed 12 years ago by
Replying to jun66j5:
Replying to ivanelson:
I am using Postgres. The error has changed:
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/ticket/templates/report_view.html", line 165, in <Expression u"format_date(from_utimestamp(long(cell.value))) if cell.value != '' else '--'"> <td class="date" py:attrs="td_attrs">${format_date(from_utimestamp(long(cell.value))) if cell.value != '' else '--'} ValueError: invalid literal for long() with base 10: '24/08/2012'That is your SQL has the issue in TracReports, not the plugin.
Also, the following in your SQL
to_char(to_timestamp(t.time/1000000),'DD/MM/YYYY') AS Created,should be
t.time AS Created,
Solved! Thank you.
comment:8 Changed 12 years ago by
Status: | assigned → new |
---|
comment:9 Changed 5 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This plugin is deprecated in Trac 1.4 and later. See migration tips on BlackMagicTicketTweaksPlugin page.
Patch against 0.11 version, r8017