Modify

Opened 8 years ago

Last modified 7 years ago

#7186 new defect

[PATCH] Don't break on invalid queries

Reported by: Matthijs Kooijman Owned by: obs
Priority: normal Component: BlackMagicTicketTweaksPlugin
Severity: normal Keywords: patch
Cc: Steven R. Loomis 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 Kooijman 8 years ago.
Patch against 0.11 version, r8017
trac.ini (3.0 KB) - added by Matthijs Kooijman 7 years ago.
trac.ini showing the breakage
bmtt.patch (991 bytes) - added by Steven R. Loomis 7 years ago.
revised again- don't assume 'id' column

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Matthijs Kooijman

Attachment: check-numrows.patch added

Patch against 0.11 version, r8017

comment:1 Changed 7 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 7 years ago by Matthijs Kooijman

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 7 years ago by Matthijs Kooijman

Attachment: trac.ini added

trac.ini showing the breakage

comment:3 Changed 7 years ago by Steven R. Loomis

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 7 years ago by Steven R. Loomis

Cc: Steven R. Loomis added; anonymous removed

Changed 7 years ago by Steven R. Loomis

Attachment: bmtt.patch added

revised again- don't assume 'id' column

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain obs.

Add Comment


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

 
Note: See TracTickets for help on using tickets.