Merge lp:~adeuring/launchpad/translation-branch-sync-return-to-referrer into lp:launchpad

Proposed by Abel Deuring
Status: Merged
Approved by: Abel Deuring
Approved revision: no longer in the source branch.
Merged at revision: 12612
Proposed branch: lp:~adeuring/launchpad/translation-branch-sync-return-to-referrer
Merge into: lp:launchpad
Diff against target: 114 lines (+27/-15)
2 files modified
lib/lp/translations/browser/productseries.py (+5/-7)
lib/lp/translations/stories/productseries/xx-productseries-translations-settings.txt (+22/-8)
To merge this branch: bzr merge lp:~adeuring/launchpad/translation-branch-sync-return-to-referrer
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) code Approve
Review via email: mp+53597@code.launchpad.net

Commit message

[r=jtv][bug=735960] Use ReturnToReferrerMixin for ProductSeriesTranslationsSettingsView

Description of the change

This branch lets the class ProductSeriesTranslationsSettingsView inherit from ReturnToReferrerMixin. This will make the changes from lp:~launchpad/launchpad/translation-sharing-status look more consistent and convenient for users: The latter branch adds a page "translation sharing status" for source packages, where users can see if a package shares translations with an upstream project. The page contains links to several forms where users can make configuration changes required for translation sharing. All these forms except for the one changed here already leads the user back to the "translation sharing status" page, so this branch just fixes an inconsistency.

The change itself is quite simple: Use another mixin class for ProductSeriesTranslationsSettingsView. Since cancel_url is set by ReturnToReferrerMixin, ProductSeriesTranslationsSettingsView should not change it, so I deleted its __init__() method.

This change requries an obviuos change to an existing page test, which also tests that the browser class indeed does what it is intended to do.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

test: ./bin/test -vvt xx-productseries-translations-settings.txt

no l int

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Very nice. Thanks for doing this.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/browser/productseries.py'
2--- lib/lp/translations/browser/productseries.py 2011-03-11 08:33:16 +0000
3+++ lib/lp/translations/browser/productseries.py 2011-03-16 10:23:26 +0000
4@@ -42,6 +42,7 @@
5 LaunchpadFormView,
6 )
7 from lp.app.enums import service_uses_launchpad
8+from lp.app.browser.launchpadform import ReturnToReferrerMixin
9 from lp.app.widgets.itemswidgets import LaunchpadRadioWidgetWithDescription
10 from lp.code.interfaces.branchjob import IRosettaUploadJobSource
11 from lp.registry.interfaces.productseries import IProductSeries
12@@ -484,8 +485,10 @@
13 self.hint = None
14
15
16-class ProductSeriesTranslationsSettingsView(LaunchpadEditFormView,
17- ProductSeriesTranslationsMixin):
18+class ProductSeriesTranslationsSettingsView(ReturnToReferrerMixin,
19+ LaunchpadEditFormView,
20+ ProductSeriesTranslationsMixin,
21+ ):
22 """Edit settings for translations import and export."""
23
24 schema = IProductSeries
25@@ -497,11 +500,6 @@
26 settings_widget = custom_widget('translations_autoimport_mode',
27 SettingsRadioWidget)
28
29- def __init__(self, context, request):
30- super(ProductSeriesTranslationsSettingsView, self).__init__(
31- context, request)
32- self.cancel_url = canonical_url(self.context, rootsite='translations')
33-
34 @action(u"Save settings", name="save_settings")
35 def change_settings_action(self, action, data):
36 """Change the translation settings."""
37
38=== modified file 'lib/lp/translations/stories/productseries/xx-productseries-translations-settings.txt'
39--- lib/lp/translations/stories/productseries/xx-productseries-translations-settings.txt 2009-12-10 10:46:05 +0000
40+++ lib/lp/translations/stories/productseries/xx-productseries-translations-settings.txt 2011-03-16 10:23:26 +0000
41@@ -1,11 +1,13 @@
42-= Changing the Bazaar import settings for a product series =
43+Changing the Bazaar import settings for a product series
44+========================================================
45
46 Product maintainers can request a one-time import of translation files
47 from the Bazaar branch that is officially linked to the release series
48 of a product. This function complements the general import settings
49 found on the "Settings" page.
50
51-== Getting there ==
52+Getting there
53+-------------
54
55 The maintainer of a product sees a menu option called "Settings" that
56 leads to the settings page.
57@@ -18,7 +20,8 @@
58 >>> print browser.url
59 http://translations.l...d.dev/evolution/trunk/+translations-settings
60
61-== The branch display ==
62+The branch display
63+------------------
64
65 An official Bazaar branch is linked to this product settings. It is
66 displayed on the page.
67@@ -47,7 +50,8 @@
68 >>> print browser.url
69 http://launchpad.dev/evolution/trunk/+linkbranch
70
71-== Pointer to one-time import ==
72+Pointer to one-time import
73+--------------------------
74
75 The user is also reminded that a one-time import of translation files
76 can be requested and a link to that page is provided.
77@@ -63,14 +67,14 @@
78 >>> print browser.url
79 http://translations.l...d.dev/evolution/trunk/+request-bzr-import
80
81-== Changing the setting ==
82+Changing the setting
83+--------------------
84
85 The setting is changed by selecting the desired mode with the radio
86 buttons in the form.
87
88- >>> browser.open(
89- ... 'http://translations.launchpad.dev/evolution/trunk/'
90- ... '+translations-settings')
91+ >>> browser.open('http://translations.launchpad.dev/evolution/trunk/')
92+ >>> browser.getLink('Set up branch synchronization').click()
93 >>> print_radio_button_field(browser.contents,
94 ... 'translations_autoimport_mode')
95 (*) None
96@@ -80,8 +84,18 @@
97 ... name='field.translations_autoimport_mode').value = (
98 ... ['IMPORT_TEMPLATES'])
99 >>> browser.getControl('Save settings').click()
100+
101+The user is automatically redirected to the page he came from.
102+
103+ >>> print browser.url
104+ http://translations.launchpad.dev/evolution/trunk/
105 >>> print "\n".join(get_feedback_messages(browser.contents))
106 The settings have been updated.
107+
108+If he looks at the synchonization settings page again, he sees that
109+the changes have been saved.
110+
111+ >>> browser.getLink('Set up branch synchronization').click()
112 >>> print_radio_button_field(browser.contents,
113 ... 'translations_autoimport_mode')
114 ( ) None