Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#8041 closed defect (fixed)

combine repeated keys in Query.from_string

Reported by: Stephen Compall <stephen.compall@…> Owned by: stephen.compall@…
Priority: normal Milestone: 0.11.3
Component: ticket system Version: 0.11.2.1
Severity: minor Keywords: patch
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Query.to_string outputs something that can be massaged lightly into input to from_string, such as this:

status=accepted&status=assigned&status=new&status=reopened \
&reporter=stephen.compall&order=priority&col=id&col=summary \
&col=type&col=priority&col=component&col=provider

(where "
\n" is removed). However, giving this string to from_string will result in a query that only looks for status=reopened. The above status specification should be interpreted the same as status=accepted|assigned|new|reopened.

Attachments (1)

combine-repeated-field-appearance-in-queries.diff (1.8 KB ) - added by Stephen Compall <stephen.compall@…> 16 years ago.
patch with unit testing

Download all attachments as: .zip

Change History (6)

by Stephen Compall <stephen.compall@…>, 16 years ago

patch with unit testing

comment:1 by Stephen Compall <stephen.compall@…>, 16 years ago

Keywords: patch added

This patch alters from_string slightly, and adds a test that compares the SQL of equivalent query strings.

comment:2 by Remy Blank, 16 years ago

Milestone: 0.11.4
Owner: set to Remy Blank

Makes sense at first sight.

comment:3 by Remy Blank, 16 years ago

Milestone: 0.11.40.11.3
Resolution: fixed
Status: newclosed

The change you propose makes sense, but not for the reason you stated above. Indeed, Query.to_string() generates a query URL (note the leading ? and the modifier after the =), whereas Query.from_string() takes a query in query syntax (modifier before the =). So you can't just take the output from the former, and pass it to the latter. Or it seems you can, but it's by coincidence.

This subtle difference between the two syntaxes is quite error-prone, and I'm trying to unify them in #7699.

Still, your proposed change makes the following queries equivalent, which is a good thing IMO:

query:owner=somebody|somebody_else
query:owner=somebody&owner=somebody_else

Patch applied (with minor fix to the test case) in [7863]. Thanks!

comment:4 by Remy Blank, 16 years ago

Owner: changed from Remy Blank to stephen.compall@…

comment:5 by Remy Blank, 15 years ago

#8329 was closed as a duplicate.

Modify Ticket

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