Modify

Opened 4 years ago

Last modified 3 years ago

#7186 new defect

[PATCH] Don't break on invalid queries

Reported by: matthijs Owned by: obs
Priority: normal Component: BlackMagicTicketTweaksPlugin
Severity: normal Keywords: patch
Cc: Srl295 Trac Release: 0.11

Description

When filtering report results, there might be no results (for example when the query is invalid). Instead, an error message is shown.

Currently, bmtt breaks the page by throwing an exception, preventing the real error message from being shown and confusing the user.

The attached patch makes bmtt check for the presence of the "numrows" value in the "report_views.html" view. If it is not present, nothing is changed.

Attachments (3)

check-numrows.patch (1.3 KB) - added by matthijs 4 years ago.
Patch against 0.11 version, r8017
trac.ini (3.0 KB) - added by matthijs 4 years ago.
trac.ini showing the breakage
bmtt.patch (991 bytes) - added by Srl295 3 years ago.
revised again- don't assume 'id' column

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by matthijs

Patch against 0.11 version, r8017

comment:1 Changed 4 years ago by obs

Cannot replicate issue against trac 0.11.7. Can you test against 0.11.7 if you still have issues provide details of your trac.ini and the query you're running.

comment:2 Changed 4 years ago by matthijs

Yup, this still happens with 0.11.7. To reproduce, simply create an invalid report. I've tested with a report containing the following query:

SELECT

I'm attaching my trac.ini, though I don't think there is anything relevant in there (in particular the bmtt section is empty).

The exact error I get is:

 Trac detected an internal error:

KeyError: 'numrows'

Changed 4 years ago by matthijs

trac.ini showing the breakage

comment:3 Changed 3 years ago by Srl295

I changed this slightly, to just detect row_groups in teh second section.

Please put this in, so that reports don't break!

I can reproduce this on trac 11.7 with this report select distinct reporter as id, "froms" as blah from ticket

comment:4 Changed 3 years ago by Srl295

  • Cc Srl295 added

Changed 3 years ago by Srl295

revised again- don't assume 'id' column

Add Comment

Modify Ticket

Action
as new .
Author


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

 
Note: See TracTickets for help on using tickets.