Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#7229 closed defect (fixed)

TicketQueryMacro not working properly with "col=..." params

Reported by: anonymous Owned by: Christian Boos
Priority: highest Milestone: 0.11
Component: ticket system Version: 0.11rc1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The macro

[[TicketQuery(format=table, milestone=milestone1, col=id)]]

correctly shows a one-column table for the selected tickets. but the macro

[[TicketQuery(format=table, milestone=milestone1,col=milestone)]]

shows the error

`Error: Macro TicketQuery(format=table, milestone=milestone1, col=milestone) failed

invalid literal for int() with base 10: 'milestone1'`

Systematics: the col param seems to work for numeric fields but not for text fields.

Attachments (1)

ticket7229.diff (2.6 KB ) - added by Johannes Plass 17 years ago.
Patch for ticket #7229

Download all attachments as: .zip

Change History (7)

comment:1 by anonymous, 17 years ago

Some more strange stuff:
1) How is one supposed to specify columns in the result table ?

Using a macro like

[[TicketQuery(format=table, milestone=testmilestone, col=id, col=time)]]

results in a one-column table only showing the time fields.

2) To circumvent 1) I tried to use the macro

[[TicketQuery(format=table&milestone=testmilestone&col=id&col=time)]]

However, this gave the error

`Error: Macro TicketQuery(format=table&milestone=testmilestone&col=id&col=time) failed

Query filter requires field and constraints separated by a "="`

comment:2 by Christian Boos, 17 years ago

Priority: normalhighest
Status: newassigned

The correct syntax for the above query would be:

[[TicketQuery(format=table, milestone=testmilestone, col=id|time)]]

The TracQuery page could certainly benefit from more samples.

The error you had with format=table&milestone=testmilestone&col=id&col=time is due to another problem (interference between format (new since 0.11) and the support for "0.10-style" arguments).

I'm working on the fix.

by Johannes Plass, 17 years ago

Attachment: ticket7229.diff added

Patch for ticket #7229

comment:3 by jplass, 17 years ago

Please find attached a patch against 0.11-stable for the bug outlined in the ticket's description. The error is in query.py:283 which assumes that the 'id' field is always the first in the query's column list. What the patch does:

  • fix the Query constructor in query.py to guarantee that the 'id' field is always present. Insert it at position 0 in the column's list if it's not already in the columns list ('id' is always needed for perm checks anyway).
  • fix the loop in query.py:283 to respect 'id' not being the first column
  • fix query_results.html to respect 'id' not being the first column

comment:4 by anonymous, 17 years ago

Summary: TicketQueryMacro not working properly with "col=..." params[PATCH]TicketQueryMacro not working properly with "col=..." params

in reply to:  4 comment:5 by Emmanuel Blot, 17 years ago

Summary: [PATCH]TicketQueryMacro not working properly with "col=..." paramsTicketQueryMacro not working properly with "col=..." params

[PATCH] is only for new ticket.

comment:6 by Christian Boos, 17 years ago

Resolution: fixed
Status: assignedclosed

Slightly modified patch applied as [7131]. The check for making sure that id was always present has been moved to get_columns.

The follow-up change [7132] was also needed to make the [[TicketQuery]] macro more robust.

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.