Aaron Bentley has proposed merging
lp:~abentley/launchpad/fix-branch-precondition into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #758919 in Launchpad itself: "412 Precondition failed error using the
selecting upstream source branch in translations sharing page"
https://bugs.launchpad.net/launchpad/+bug/758919
For more details, see:
https://code.launchpad.net/~abentley/launchpad/fix-branch-precondition/+merge/57550
= Summary =
Fix bug #758919: Precondition failed error using the selecting upstream source
branch in translations sharing page.
== Proposed fix ==
Reload the productseries after submitting usage form.
== Pre-implementation notes ==
None
== Implementation details ==
The error occurred if the translation usage was changed before the branch was
changed. It's not clear why changing the product changes the ETAG of the
productseries, but it apparently does. Reloading the productseries refrehes
the ETAG, which allows the branch to be set. This solution adds latency, but
is simple and correct.
== Tests ==
None
== Demo and Q/A ==
Go to
https://translations.qastaging.launchpad.net/ubuntu/natty/+source/gnuhello/+sharing-details
and change the usage settings. Then change the branch. The branch should
change, and you should not get 412 Precondition failed.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/translations/javascript/sourcepackage_sharing_details.js
--
https://code.launchpad.net/~abentley/launchpad/fix-branch-precondition/+merge/57550
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~abentley/launchpad/fix-branch-precondition into lp:launchpad.
=== modified file 'lib/lp/translations/javascript/sourcepackage_sharing_details.js'
--- lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-07 15:44:38 +0000
+++ lib/lp/translations/javascript/sourcepackage_sharing_details.js 2011-04-13 17:47:29 +0000
@@ -542,8 +542,19 @@
usage_overlay.set('form_submit_callback', function(form_data) {
usage_overlay.hide();
var product = sharing_controller.get('product');
+ function reload_entry(config, entry) {
+ lp_client.get(entry.get('self_link'), config);
+ }
+ function get_productseries(config) {
+ var productseries = sharing_controller.get('productseries');
+ reload_entry(config, productseries);
+ }
+ function replace_productseries(config, new_productseries) {
+ sharing_controller.replace_productseries(new_productseries);
+ config.on.success();
+ }
function get_product(config) {
- lp_client.get(product.get('self_link'), config);
+ reload_entry(config, product);
}
function replace_product(new_product) {
sharing_controller.replace_product(new_product);
@@ -553,7 +564,9 @@
css_selector = sharing_controller.visible_check_selector(usage);
var io_handler = new IOHandler(
css_selector, new Y.lp.client.FormErrorHandler());
- var config = io_handler.chain_config(get_product, replace_product);
+ var config = io_handler.chain_config(
+ get_productseries, replace_productseries, get_product,
+ replace_product);
submit_form(
config, form_data, product, '+configure-translations', 'change');
});
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp