Edgewall Software
Modify

Ticket #5806 (closed defect: duplicate)

Opened 5 years ago

Last modified 2 years ago

[PATCH] Impossible to edit or delete a malformed custom query

Reported by: dmaraglia at lightfleet.com Owned by: rblank
Priority: high Milestone:
Component: report system Version: 0.10.4
Severity: normal Keywords: custom report verify
Cc:
Release Notes:
API Changes:

Description

Running trac 10.4 under CentOS 4.5 x86_64

After creating a malformed custom query, it is not possible to delete the report. The normal method for deleting a report is to select the query, waitt for it to finish, and then you are presented with buttons to "Copy", "Edit", and "Delete" report; however, if the query is malformed, you are never presented with these buttons, just the error output.

Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 406, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.3/site-packages/trac/ticket/report.py", line 88, in process_request
    resp = self._render_view(req, db, id)
  File "/usr/lib/python2.3/site-packages/trac/ticket/report.py", line 346, in _render_view
    value['date'] = format_date(cell)
  File "/usr/lib/python2.3/site-packages/trac/util/datefmt.py", line 68, in format_date
    return format_datetime(t, format, gmt)
  File "/usr/lib/python2.3/site-packages/trac/util/datefmt.py", line 58, in format_datetime
    t = time.localtime(float(t))
ValueError: invalid literal for float(): 3232014-06-15

Attachments

5806_fix.patch (6.3 KB) - added by François Terrier <fterrier@…> 2 years ago.

Download all attachments as: .zip

Change History

comment:1 Changed 5 years ago by eblot

  • Component changed from trac-admin to report system
  • Keywords verify added; delete edit removed
  • Owner changed from cmlenz to mgood

I though this issue had already been addressed ... maybe for 0.11.

comment:2 Changed 4 years ago by cboos

  • Milestone changed from 0.11 to 0.11.1

A few comments:

  1. some errors, like malformed SQL, are correctly trapped and don't prevent the rendering of the page. However, there are simply no row shown and no reporting of the error itself and that should probably be improved.
  2. other errors which happen at rendering time only (like trying to convert something as a date when it's not a date) are still shown as internal errors. However, there's a simple enough workaround: simply add ?action=edit to the reporit URL.

Therefore, solving 1. and 2. can be safely post-poned to 0.11.x.

comment:3 Changed 4 years ago by sid

#4510 was marked as duplicate of this ticket.

comment:4 Changed 4 years ago by cboos

  • Priority changed from normal to high

#5635 was closed as duplicate.

See also related #5445 (as we need to trap db errors in a db neutral way).

comment:5 Changed 4 years ago by cboos

Well, I meant #6348 instead of #5445.

comment:6 follow-up: Changed 4 years ago by kirean@…

A workaround for this situation is to add ?action=delete to the report url.
Like: http://myhost.com/trac/report/1?action=delete

comment:7 in reply to: ↑ 6 Changed 4 years ago by kirean@…

Replying to kirean@gmail.com:

A workaround for this situation is to add ?action=delete to the report url.
Like: http://myhost.com/trac/report/1?action=delete

And ?action=edit to be able to edit the report..

comment:8 Changed 4 years ago by cboos

#6977 closed as duplicate.

comment:9 Changed 3 years ago by cboos

  • Milestone changed from 0.11-retriage to 0.11.5

Move high prio tickets from 0.11-retriage to next maintenance release.

comment:10 Changed 3 years ago by cboos

  • Milestone changed from 0.11.6 to 0.12
  • Owner mgood deleted

Changed 2 years ago by François Terrier <fterrier@…>

comment:11 Changed 2 years ago by François Terrier <fterrier@…>

  • Summary changed from Impossible to edit or delete a malformed custom query to [PATCH] Impossible to edit or delete a malformed custom query

the submitted patch fixes the problem :

  • added a new type field in the header variable passed to the template that is supposed to carry the type of the column. Is just set to the same value as col at the moment but maybe it will be used one day (otherwise we can get rid of it)
  • for each header, checks if it is a 'reserved' header name (datetime, time, created, modified, ...) if it is the case and one of the value is not compatible (not an integer), it just prefixes the type with sql. so it does not get converted in the template, and adds an error message

comment:12 Changed 2 years ago by rblank

  • Owner set to rblank

I would rather add a possibility to edit a report without having to view the report and hence triggering the error. I would suggest we add a column to the list of reports, with links to the ?action=edit pages.

comment:13 Changed 2 years ago by cboos

It would be nice to have the link only when one has the REPORT_EDIT permission on the report.

For that, we should be to use a dedicated report_list.html template, instead of continuing to reuse a normal report view for displaying the list of reports, as this "special" report is hard-coded anyway.

comment:14 Changed 2 years ago by cboos

... REPORT_MODIFY I meant.

And btw, that's also what #1876 was about. Mark this as duplicate and work on #1876?

comment:15 Changed 2 years ago by rblank

  • Milestone 0.12 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Absolutely. Closing as a duplicate of #1876.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from rblank. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.