launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03447
lp:~allenap/launchpad/deriveDistroSeries-json-weirdness-bug-753249 into lp:launchpad
Gavin Panella has proposed merging lp:~allenap/launchpad/deriveDistroSeries-json-weirdness-bug-753249 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #753249 in Launchpad itself: "+initseries calls deriveDistroSeries() with incorrect arguments"
https://bugs.launchpad.net/launchpad/+bug/753249
For more details, see:
https://code.launchpad.net/~allenap/launchpad/deriveDistroSeries-json-weirdness-bug-753249/+merge/59120
append_qs() in client.js could not deal with array argument values
properly. This is something that any API call that accepts a list
needs, so I've implemented it.
I've manually verified that this fixes the linked bug. I started work
on a Windmill test, but got stupid errors from Windmill regarding
profiles in Firefox. Purging Firefox and re-installing makes no
difference. I've dumped the work I've started into another branch and
I'll file a bug for that. Meanwhile I want to get this landed.
--
https://code.launchpad.net/~allenap/launchpad/deriveDistroSeries-json-weirdness-bug-753249/+merge/59120
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/deriveDistroSeries-json-weirdness-bug-753249 into lp:launchpad.
=== modified file 'lib/lp/app/javascript/client.js'
--- lib/lp/app/javascript/client.js 2011-04-19 18:14:20 +0000
+++ lib/lp/app/javascript/client.js 2011-04-26 19:38:03 +0000
@@ -92,7 +92,14 @@
if (qs.length > 0) {
qs += '&';
}
- qs += encodeURIComponent(key) + "=" + encodeURIComponent(value);
+ if (Y.Lang.isArray(value)) {
+ for (var i = 0; i < value.length; i++) {
+ qs = arguments.callee(qs, key, value[i]);
+ }
+ }
+ else {
+ qs += encodeURIComponent(key) + "=" + encodeURIComponent(value);
+ }
return qs;
};
=== modified file 'lib/lp/app/javascript/tests/test_lp_client.js'
--- lib/lp/app/javascript/tests/test_lp_client.js 2011-04-11 12:52:27 +0000
+++ lib/lp/app/javascript/tests/test_lp_client.js 2011-04-26 19:38:03 +0000
@@ -33,6 +33,14 @@
Assert.areEqual("P%C3%83%C2%B6ll%C3%83%C2%A4=Perell%C3%83%C2%B3", qs);
},
+ test_append_qs_with_array: function() {
+ // append_qs() appends multiple arguments to the query string
+ // when a parameter value is an array.
+ var qs = "";
+ qs = Y.lp.client.append_qs(qs, "foo", ["bar", "baz"]);
+ Assert.areEqual("foo=bar&foo=baz", qs);
+ },
+
test_field_uri: function() {
var get_field_uri = Y.lp.client.get_field_uri;
Assert.areEqual(get_field_uri("http://www.example.com/api/devel/foo", "field"),