Edgewall Software
Modify

Opened 17 years ago

Closed 15 years ago

#5806 closed defect (duplicate)

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

Reported by: dmaraglia at lightfleet.com Owned by: Remy Blank
Priority: high Milestone:
Component: report system Version: 0.10.4
Severity: normal Keywords: custom report verify
Cc: Branch:
Release Notes:
API Changes:
Internal 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 (1)

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

Download all attachments as: .zip

Change History (16)

comment:1 by Emmanuel Blot, 17 years ago

Component: trac-adminreport system
Keywords: verify added; delete edit removed
Owner: changed from Christopher Lenz to Matthew Good

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

comment:2 by Christian Boos, 17 years ago

Milestone: 0.110.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 by sid, 17 years ago

#4510 was marked as duplicate of this ticket.

comment:4 by Christian Boos, 17 years ago

Priority: normalhigh

#5635 was closed as duplicate.

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

comment:5 by Christian Boos, 17 years ago

Well, I meant #6348 instead of #5445.

comment:6 by kirean@…, 17 years ago

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

in reply to:  6 comment:7 by kirean@…, 17 years ago

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 by Christian Boos, 17 years ago

#6977 closed as duplicate.

comment:9 by Christian Boos, 16 years ago

Milestone: 0.11-retriage0.11.5

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

comment:10 by Christian Boos, 15 years ago

Milestone: 0.11.60.12
Owner: Matthew Good removed

by François Terrier <fterrier@…>, 15 years ago

Attachment: 5806_fix.patch added

comment:11 by François Terrier <fterrier@…>, 15 years ago

Summary: Impossible to edit or delete a malformed custom query[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 by Remy Blank, 15 years ago

Owner: set to Remy Blank

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 by Christian Boos, 15 years ago

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 by Christian Boos, 15 years ago

… REPORT_MODIFY I meant.

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

comment:15 by Remy Blank, 15 years ago

Milestone: 0.12
Resolution: duplicate
Status: newclosed

Absolutely. Closing as a duplicate of #1876.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


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