Opened 18 years ago
Closed 17 years ago
#4510 closed defect (duplicate)
Exception when creating report where 'created' column is not a float
Reported by: | anonymous | Owned by: | Matthew Good |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | report system | Version: | 0.10.2 |
Severity: | major | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When I create report with this query:
SELECT strftime('%d.%m.%Y',time , 'unixepoch', 'localtime') AS created FROM ticket t
I get this exception:
Python Traceback Traceback (most recent call last): File "/var/lib/python-support/python2.4/trac/web/main.py", line 387, in dispatch_request dispatcher.dispatch(req) File "/var/lib/python-support/python2.4/trac/web/main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "/var/lib/python-support/python2.4/trac/ticket/report.py", line 88, in process_request resp = self._render_view(req, db, id) File "/var/lib/python-support/python2.4/trac/ticket/report.py", line 346, in _render_view value['date'] = format_date(cell) File "/var/lib/python-support/python2.4/trac/util/datefmt.py", line 68, in format_date return format_datetime(t, format, gmt) File "/var/lib/python-support/python2.4/trac/util/datefmt.py", line 58, in format_datetime t = time.localtime(float(t)) ValueError: invalid literal for float(): 28.11.2006
If I change column name in query to 'Created' (with capital C) it works correctly.
When this happens I can't remove broken report because page that contains 'Delete report' button throws exception.
I think this happens because column with name 'created' gets special treatment. Code should check that the value it gets from from query is actually a float.
Attachments (0)
Change History (5)
comment:1 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 18 years ago
Maybe my description was bit unclear. The actual problem is that in certain cases Delete report button disappears.
- If I create certain kind of malformed SELECT clause on report
- then I get stacktrace
- and delete report -button is missing
- and I can't remove that malformed select clause any more.
The obvious workaround is of course not to use strftime
with created -column, but if you happen to use strftime, there should be delete report button so you can fix situation.
comment:3 by , 18 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:4 by , 18 years ago
I can confirm this. Perhaps Trac should handle this exception by assuming a custom date format has been given, and display that instead of trying to assume it's a float and format it itself. Or even if not, it should treat it as an invalid query. Instead it just raises an exception, and there is no way to modify or delete the report without going directly through the DB.
comment:5 by , 17 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
In that case, this becomes a duplicate of #5806. This is older, but that has a better description of the problem and is already assigned to a milestone.
Yes, the "created" column is automatically formatted by Trac as a date. Instead of using
strftime
just allow Trac to format it.