Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#6271 closed defect (fixed)

Error is not reported for invalid SQL in report queries.

Reported by: tjorvi@… Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: ticket system Version: devel
Severity: trivial Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Instead of reporting an error, trac act as if the report executed correctly but returned no results.

This seems to be because of a parameter mismatch between the exception handler in ReportModule._render_view(), and the report_view.html template.

report_view.html is expecting report.message to contain error messages, but _render_view is sending message.

Here is a patch that solves the problem in one fashion:

Index: trac/ticket/report.py
===================================================================
--- trac/ticket/report.py       (revision 6114)
+++ trac/ticket/report.py       (working copy)
@@ -279,8 +279,8 @@
         try:
             cols, results = self.execute_report(req, db, id, sql, args)
         except Exception, e:
-            data['message'] = _('Report execution failed: %(error)s',
-                                error=to_unicode(e))
+            data['report'] = {'message':_('Report execution failed: %(error)s',
+                                error=to_unicode(e))}
             return 'report_view.html', data, None

         sort_col = req.args.get('sort', '')

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 17 years ago

Owner: changed from Jonas Borgström to Christian Boos
Severity: normaltrivial

You're right. Thanks for the report & patch!

comment:2 by Christian Boos, 17 years ago

Status: newassigned

(well, incidentally I already fixed it in the context-refactoring branch, waiting for the merge)

comment:3 by Christian Boos, 17 years ago

Resolution: fixed
Status: assignedclosed

Now in trunk (r6139).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos 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.