#8041 closed defect (fixed)
combine repeated keys in Query.from_string
Reported by: | Owned by: | ||
---|---|---|---|
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)
Change History (6)
by , 16 years ago
Attachment: | combine-repeated-field-appearance-in-queries.diff added |
---|
comment:1 by , 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:3 by , 16 years ago
Milestone: | 0.11.4 → 0.11.3 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
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 , 16 years ago
Owner: | changed from | to
---|
patch with unit testing