Merge lp:~adiroiban/launchpad/bug-487137 into lp:launchpad

Proposed by Adi Roiban
Status: Rejected
Rejected by: Данило Шеган
Proposed branch: lp:~adiroiban/launchpad/bug-487137
Merge into: lp:launchpad
Diff against target: 402 lines (+108/-57)
9 files modified
lib/canonical/launchpad/security.py (+24/-0)
lib/lp/translations/browser/configure.zcml (+3/-3)
lib/lp/translations/browser/customlanguagecode.py (+1/-1)
lib/lp/translations/stories/standalone/custom-language-codes.txt (+55/-47)
lib/lp/translations/templates/customlanguagecode-index.pt (+1/-1)
lib/lp/translations/templates/customlanguagecode-remove.pt (+18/-0)
lib/lp/translations/templates/customlanguagecodes-index.pt (+4/-3)
lib/lp/translations/templates/product-portlet-translatables.pt (+1/-1)
lib/lp/translations/templates/sourcepackage-translations.pt (+1/-1)
To merge this branch: bzr merge lp:~adiroiban/launchpad/bug-487137
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Review via email: mp+23901@code.launchpad.net

Commit message

Allow Rosetta Experts to administer custom language codes.

Description of the change

= Bug 487137 =

Now that we have the custom language codes UI (bug 271747), we should allow Translations experts to create and remove custom language codes.

This was always planned, but didn't fit in the original branch.

== Proposed fix ==

Use launchpad.TranslationsAdmin for checking admin permissions for custom language codes.
Allow Launchpad Admin and Rosetta Admin launchpad.TranslationsAdmin rights on ICustomLanguageCode and IHasCustomLanguageCodes.

== Pre-implementation notes ==

None yet.

== Implementation details ==

Nothing special.

I don't know what is the best method for testing permission, since all permission checking tests should be done using a Launchpad admins and a Rosetta expert.

'make lint' sometimes gives me > bzr: ERROR: unknown command "pipes"

== Tests ==

lp-test custom-language-codes

== Demo and Q/A ==

Login as Rosetta Administrator.
Go to a product or sourcepackage page:

https://translations.launchpad.dev/evolution
https://translations.launchpad.dev/ubuntu/+source/evolution

You should see a link for defining custom language codes.
Click on the link.
Add a language code.
Click on the new language code.
Remove the language code.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/security.py
  lib/lp/translations/browser/configure.zcml
  lib/lp/translations/browser/customlanguagecode.py
  lib/lp/translations/stories/standalone/custom-language-codes.txt
  lib/lp/translations/templates/customlanguagecode-index.pt
  lib/lp/translations/templates/customlanguagecodes-index.pt
  lib/lp/translations/templates/product-portlet-translatables.pt
  lib/lp/translations/templates/sourcepackage-translations.pt

To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (4.3 KiB)

Hi Adi!

Thanks for yet another branch. The test is failing for me locally, and I've a few typo fixes below. Once they're fixed up, r=me.

Thanks!

On Thu, Apr 22, 2010 at 5:19 AM, Adi Roiban <email address hidden> wrote:
> Adi Roiban has proposed merging lp:~adiroiban/launchpad/bug-487137 into lp:launchpad/devel.
...
>
> == Tests ==<email address hidden>
>
> lp-test custom-language-codes

Running the test results in a failure:
http://pastebin.ubuntu.com/420372/

>
> == Demo and Q/A ==
>
> Login as Rosetta Administrator.
> Go to a product or sourcepackage page:
>
> https://translations.launchpad.dev/evolution
> https://translations.launchpad.dev/ubuntu/+source/evolution
>
> You should see a link for defining custom language codes.
> Click on the link.
> Add a language code.
> Click on the new language code.
> Remove the language code.

Great. Strangely, reverting your security.py change and logging in as <email address hidden> still allows me to create language codes, just not delete them.

I see it's not really part of this branch, but when removing a language there is no text (other than the main heading, breadcrumbs and the remove or cancel options). It looks a bit strange, and any text would just be repeating what the main heading already says, but adding the label to the form might look less strange... see what you think (as it's not part of this branch, I'll leave it up to you).

> === modified file 'lib/canonical/launchpad/security.py'
> --- lib/canonical/launchpad/security.py 2010-04-18 22:31:40 +0000
> +++ lib/canonical/launchpad/security.py 2010-04-22 03:19:15 +0000
> @@ -112,6 +112,8 @@
> from lp.blueprints.interfaces.sprintspecification import (
> ISprintSpecification)
> from lp.registry.interfaces.teammembership import ITeamMembership
> +from lp.translations.interfaces.customlanguagecode import (
> + ICustomLanguageCode, IHasCustomLanguageCodes)
> from lp.translations.interfaces.translationgroup import (
> ITranslationGroup, ITranslationGroupSet)
> from lp.translations.interfaces.translationimportqueue import (
> @@ -1652,6 +1654,28 @@
> usedfor = ILanguage
>
>
> +class AdminCustomLanguageCodes(OnlyRosettaExpertsAndAdmins):
> + """Controls administration of custom language codes.
> +
> + Rosetta expters and Launchpad administrators can admister custom language

s/expters/experts
s/admister/administer

> + codes.
> + """
> +
> + permission = 'launchpad.TranslationsAdmin'
> + usedfor = IHasCustomLanguageCodes
> +
> +
> +class AdminCustomLanguageCode(OnlyRosettaExpertsAndAdmins):
> + """Controls administration for a custom language code.
> +
> + Rosetta expters and Launchpad administrators can admister a custom

as above.

> + language code.
> + """
> +
> + permission = 'launchpad.TranslationsAdmin'
> + usedfor = ICustomLanguageCode
> +
> +
> class AccessBranch(AuthorizationBase):
> """Controls visibility of branches.
>
>

> === modified file 'lib/lp/translations/stories/standalone/custom-language-codes.txt'
> --- lib/lp/translations/stories/standalone/custom-language-codes.txt 2010-03-11 20:54:36 +0000
> +++ lib/lp/translations/stories/standalone/custom-language-codes.txt 2010-04-22 03:19:15 +0000
....

Read more...

review: Approve (code)
Revision history for this message
Adi Roiban (adiroiban) wrote :
Download full text (7.1 KiB)

> Hi Adi!
>
> Thanks for yet another branch. The test is failing for me locally, and I've a
> few typo fixes below. Once they're fixed up, r=me.

Thanks for taking the time and review this branch!
Please see my inline comments.

[snip]

> > lp-test custom-language-codes
>
> Running the test results in a failure:
> http://pastebin.ubuntu.com/420372/

Test fixed.
It was my fault for changing the test and not running it again.

> > == Demo and Q/A ==
> >
> > Login as Rosetta Administrator.
> > Go to a product or sourcepackage page:
> >
> > https://translations.launchpad.dev/evolution
> > https://translations.launchpad.dev/ubuntu/+source/evolution
> >
> > You should see a link for defining custom language codes.
> > Click on the link.
> > Add a language code.
> > Click on the new language code.
> > Remove the language code.
>
> Great. Strangely, reverting your security.py change and logging in as
> <email address hidden> still allows me to create language codes, just not delete them.

Yes. It should work for IProduct since Rosetta Experts have already translations admin right on IProduct which implements IHasCustomLangaugeCode. They don't have this right on ISourcePackage which also implement IHasCustomLangaugeCode.

> I see it's not really part of this branch, but when removing a language there
> is no text (other than the main heading, breadcrumbs and the remove or cancel
> options). It looks a bit strange, and any text would just be repeating what
> the main heading already says, but adding the label to the form might look
> less strange... see what you think (as it's not part of this branch, I'll
> leave it up to you).

I have added the text:
You are going to remove the custom language code "LC".

> > === modified file 'lib/canonical/launchpad/security.py'
> > --- lib/canonical/launchpad/security.py 2010-04-18 22:31:40 +0000
> > +++ lib/canonical/launchpad/security.py 2010-04-22 03:19:15 +0000
> > @@ -112,6 +112,8 @@
> > from lp.blueprints.interfaces.sprintspecification import (
> > ISprintSpecification)
> > from lp.registry.interfaces.teammembership import ITeamMembership
> > +from lp.translations.interfaces.customlanguagecode import (
> > + ICustomLanguageCode, IHasCustomLanguageCodes)
> > from lp.translations.interfaces.translationgroup import (
> > ITranslationGroup, ITranslationGroupSet)
> > from lp.translations.interfaces.translationimportqueue import (
> > @@ -1652,6 +1654,28 @@
> > usedfor = ILanguage
> >
> >
> > +class AdminCustomLanguageCodes(OnlyRosettaExpertsAndAdmins):
> > + """Controls administration of custom language codes.
> > +
> > + Rosetta expters and Launchpad administrators can admister custom
> language
>
> s/expters/experts
> s/admister/administer

Fixed.

> > + codes.
> > + """
> > +
> > + permission = 'launchpad.TranslationsAdmin'
> > + usedfor = IHasCustomLanguageCodes
> > +
> > +
> > +class AdminCustomLanguageCode(OnlyRosettaExpertsAndAdmins):
> > + """Controls administration for a custom language code.
> > +
> > + Rosetta expters and Launchpad administrators can admister a custom
>
> as above.

Fixed.
[snip]
> > -An administrator sees the link to the custom language codes on a
> ...

Read more...

Revision history for this message
Michael Nelson (michael.nelson) wrote :

Great, thanks for those changes Adi.

Just ping me and I'll send this off to land if you're happy with it.

Revision history for this message
Данило Шеган (danilo) wrote :

Henning has picked up this branch and massaged it for landing. Thanks Adi for the work on it so far :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2010-04-20 08:01:41 +0000
+++ lib/canonical/launchpad/security.py 2010-04-22 16:33:28 +0000
@@ -112,6 +112,8 @@
112from lp.blueprints.interfaces.sprintspecification import (112from lp.blueprints.interfaces.sprintspecification import (
113 ISprintSpecification)113 ISprintSpecification)
114from lp.registry.interfaces.teammembership import ITeamMembership114from lp.registry.interfaces.teammembership import ITeamMembership
115from lp.translations.interfaces.customlanguagecode import (
116 ICustomLanguageCode, IHasCustomLanguageCodes)
115from lp.translations.interfaces.translationgroup import (117from lp.translations.interfaces.translationgroup import (
116 ITranslationGroup, ITranslationGroupSet)118 ITranslationGroup, ITranslationGroupSet)
117from lp.translations.interfaces.translationimportqueue import (119from lp.translations.interfaces.translationimportqueue import (
@@ -1652,6 +1654,28 @@
1652 usedfor = ILanguage1654 usedfor = ILanguage
16531655
16541656
1657class AdminCustomLanguageCodes(OnlyRosettaExpertsAndAdmins):
1658 """Controls administration of custom language codes.
1659
1660 Rosetta experts and Launchpad administrators can administer custom
1661 language codes.
1662 """
1663
1664 permission = 'launchpad.TranslationsAdmin'
1665 usedfor = IHasCustomLanguageCodes
1666
1667
1668class AdminCustomLanguageCode(OnlyRosettaExpertsAndAdmins):
1669 """Controls administration for a custom language code.
1670
1671 Rosetta experts and Launchpad administrators can administer a custom
1672 language code.
1673 """
1674
1675 permission = 'launchpad.TranslationsAdmin'
1676 usedfor = ICustomLanguageCode
1677
1678
1655class AccessBranch(AuthorizationBase):1679class AccessBranch(AuthorizationBase):
1656 """Controls visibility of branches.1680 """Controls visibility of branches.
16571681
16581682
=== modified file 'lib/lp/translations/browser/configure.zcml'
--- lib/lp/translations/browser/configure.zcml 2010-04-19 08:11:52 +0000
+++ lib/lp/translations/browser/configure.zcml 2010-04-22 16:33:28 +0000
@@ -1001,9 +1001,9 @@
1001 <browser:page1001 <browser:page
1002 name="+remove"1002 name="+remove"
1003 for="lp.translations.interfaces.customlanguagecode.ICustomLanguageCode"1003 for="lp.translations.interfaces.customlanguagecode.ICustomLanguageCode"
1004 permission="launchpad.Admin"1004 permission="launchpad.TranslationsAdmin"
1005 class="lp.translations.browser.customlanguagecode.CustomLanguageCodeRemoveView"1005 class="lp.translations.browser.customlanguagecode.CustomLanguageCodeRemoveView"
1006 template="../../app/templates/generic-edit.pt"1006 template="../templates/customlanguagecode-remove.pt"
1007 layer="canonical.launchpad.layers.TranslationsLayer"/>1007 layer="canonical.launchpad.layers.TranslationsLayer"/>
10081008
1009<!-- IHasCustomLanguageCodes -->1009<!-- IHasCustomLanguageCodes -->
@@ -1021,7 +1021,7 @@
1021 layer="canonical.launchpad.layers.TranslationsLayer"1021 layer="canonical.launchpad.layers.TranslationsLayer"
1022 class="lp.translations.browser.customlanguagecode.CustomLanguageCodeAddView"1022 class="lp.translations.browser.customlanguagecode.CustomLanguageCodeAddView"
1023 template="../templates/customlanguagecode-add.pt"1023 template="../templates/customlanguagecode-add.pt"
1024 permission="launchpad.Admin"/>1024 permission="launchpad.TranslationsAdmin"/>
10251025
1026 </facet>1026 </facet>
1027</configure>1027</configure>
10281028
=== modified file 'lib/lp/translations/browser/customlanguagecode.py'
--- lib/lp/translations/browser/customlanguagecode.py 2009-11-13 16:18:54 +0000
+++ lib/lp/translations/browser/customlanguagecode.py 2010-04-22 16:33:28 +0000
@@ -11,7 +11,7 @@
11 'CustomLanguageCodeView',11 'CustomLanguageCodeView',
12 'HasCustomLanguageCodesNavigation',12 'HasCustomLanguageCodesNavigation',
13 'HasCustomLanguageCodesTraversalMixin',13 'HasCustomLanguageCodesTraversalMixin',
14 ]14 ]
1515
1616
17import re17import re
1818
=== modified file 'lib/lp/translations/stories/standalone/custom-language-codes.txt'
--- lib/lp/translations/stories/standalone/custom-language-codes.txt 2010-03-11 20:54:36 +0000
+++ lib/lp/translations/stories/standalone/custom-language-codes.txt 2010-04-22 16:33:28 +0000
@@ -11,7 +11,6 @@
11Custom language codes are attached to either a product or a source11Custom language codes are attached to either a product or a source
12package.12package.
1313
14 >>> import re
15 >>> from zope.component import getUtility14 >>> from zope.component import getUtility
16 >>> from zope.security.proxy import removeSecurityProxy15 >>> from zope.security.proxy import removeSecurityProxy
17 >>> from canonical.launchpad.interfaces.launchpad import (16 >>> from canonical.launchpad.interfaces.launchpad import (
@@ -35,9 +34,10 @@
35 >>> logout()34 >>> logout()
3635
37 >>> owner_browser = setupBrowser("Basic o@example.com:test")36 >>> owner_browser = setupBrowser("Basic o@example.com:test")
37 >>> rosetta_admin_browser = setupRosettaExpertBrowser()
3838
39An administrator sees the link to the custom language codes on a39A Launchpad administrator or Rosetta expert sees the link to the custom
40project's main translations page.40language codes on a project's main translations page.
4141
42 >>> admin_browser.open(product_page)42 >>> admin_browser.open(product_page)
43 >>> tag = find_custom_language_codes_link(admin_browser)43 >>> tag = find_custom_language_codes_link(admin_browser)
@@ -46,10 +46,17 @@
46 define custom language codes46 define custom language codes
47 for this project.47 for this project.
4848
49 >>> rosetta_admin_browser.open(product_page)
50 >>> tag = find_custom_language_codes_link(rosetta_admin_browser)
51 >>> print extract_text(tag.renderContents())
52 If necessary, you may
53 define custom language codes
54 for this project.
55
49The link goes to the custom language codes management page.56The link goes to the custom language codes management page.
5057
51 >>> admin_browser.getLink("define custom language codes").click()58 >>> rosetta_admin_browser.getLink("define custom language codes").click()
52 >>> custom_language_codes_page = admin_browser.url59 >>> custom_language_codes_page = rosetta_admin_browser.url
5360
54Non-admins, even the project's owner, don't see this link. We do not61Non-admins, even the project's owner, don't see this link. We do not
55advertise this feature, since the proper solution is generally to use62advertise this feature, since the proper solution is generally to use
@@ -61,26 +68,26 @@
6168
62Initially the page shows no custom language codes for the project.69Initially the page shows no custom language codes for the project.
6370
64 >>> tag = find_tag_by_id(admin_browser.contents, 'empty')71 >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty')
65 >>> print extract_text(tag.renderContents())72 >>> print extract_text(tag.renderContents())
66 No custom language codes have been defined.73 No custom language codes have been defined.
6774
68The admin can add a custom language code.75The admin can add a custom language code.
6976
70 >>> admin_browser.getLink("Add a custom language code").click()77 >>> rosetta_admin_browser.getLink("Add a custom language code").click()
71 >>> add_page = admin_browser.url78 >>> add_page = rosetta_admin_browser.url
7279
73 >>> admin_browser.getControl("Language code:").value = 'no'80 >>> rosetta_admin_browser.getControl("Language code:").value = 'no'
74 >>> admin_browser.getControl("Language:").value = ['nn']81 >>> rosetta_admin_browser.getControl("Language:").value = ['nn']
75 >>> admin_browser.getControl("Add").click()82 >>> rosetta_admin_browser.getControl("Add").click()
7683
77This leads back to the custom language codes overview, where the new84This leads back to the custom language codes overview, where the new
78code is now shown.85code is now shown.
7986
80 >>> admin_browser.url == custom_language_codes_page87 >>> rosetta_admin_browser.url == custom_language_codes_page
81 True88 True
8289
83 >>> tag = find_tag_by_id(admin_browser.contents, 'nonempty')90 >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'nonempty')
84 >>> print extract_text(tag.renderContents())91 >>> print extract_text(tag.renderContents())
85 Foo uses the following custom language codes:92 Foo uses the following custom language codes:
86 Code... ...maps to language93 Code... ...maps to language
@@ -89,8 +96,8 @@
89There is an overview page for the custom code, though there's not much96There is an overview page for the custom code, though there's not much
90to see there.97to see there.
9198
92 >>> admin_browser.getLink("no").click()99 >>> rosetta_admin_browser.getLink("no").click()
93 >>> main = find_main_content(admin_browser.contents)100 >>> main = find_main_content(rosetta_admin_browser.contents)
94 >>> print extract_text(main.renderContents())101 >>> print extract_text(main.renderContents())
95 Foo Translations Custom language code ...no...102 Foo Translations Custom language code ...no...
96 For Foo, uploads with the language code103 For Foo, uploads with the language code
@@ -102,26 +109,27 @@
102109
103The overview page leads back to the custom language codes overview.110The overview page leads back to the custom language codes overview.
104111
105 >>> code_page = admin_browser.url112 >>> code_page = rosetta_admin_browser.url
106 >>> admin_browser.getLink("custom language codes overview").click()113 >>> rosetta_admin_browser.getLink(
107 >>> admin_browser.url == custom_language_codes_page114 ... "custom language codes overview").click()
115 >>> rosetta_admin_browser.url == custom_language_codes_page
108 True116 True
109117
110 >>> admin_browser.open(code_page)118 >>> rosetta_admin_browser.open(code_page)
111119
112There is also a link for removing codes. The admin follows the link and120There is also a link for removing codes. The admin follows the link and
113removes the "no" custom language code.121removes the "no" custom language code.
114122
115 >>> admin_browser.getLink("remove custom language code").click()123 >>> rosetta_admin_browser.getLink("remove custom language code").click()
116 >>> remove_page = admin_browser.url124 >>> remove_page = rosetta_admin_browser.url
117 >>> admin_browser.getControl("Remove").click()125 >>> rosetta_admin_browser.getControl("Remove").click()
118126
119This leads back to the overview page.127This leads back to the overview page.
120128
121 >>> admin_browser.url == custom_language_codes_page129 >>> rosetta_admin_browser.url == custom_language_codes_page
122 True130 True
123131
124 >>> tag = find_tag_by_id(admin_browser.contents, 'empty')132 >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty')
125 >>> print extract_text(tag.renderContents())133 >>> print extract_text(tag.renderContents())
126 No custom language codes have been defined.134 No custom language codes have been defined.
127135
@@ -155,10 +163,10 @@
155And naturally, if an admin creates a custom language code again, a163And naturally, if an admin creates a custom language code again, a
156non-admin can't remove it.164non-admin can't remove it.
157165
158 >>> admin_browser.open(add_page)166 >>> rosetta_admin_browser.open(add_page)
159 >>> admin_browser.getControl("Language code:").value = 'no'167 >>> rosetta_admin_browser.getControl("Language code:").value = 'no'
160 >>> admin_browser.getControl("Language:").value = ['nn']168 >>> rosetta_admin_browser.getControl("Language:").value = ['nn']
161 >>> admin_browser.getControl("Add").click()169 >>> rosetta_admin_browser.getControl("Add").click()
162170
163 >>> owner_browser.open(custom_language_codes_page)171 >>> owner_browser.open(custom_language_codes_page)
164 >>> tag = find_tag_by_id(owner_browser.contents, 'nonempty')172 >>> tag = find_tag_by_id(owner_browser.contents, 'nonempty')
@@ -210,36 +218,36 @@
210 ... rootsite="translations")218 ... rootsite="translations")
211 >>> logout()219 >>> logout()
212220
213 >>> admin_browser.open(package_page)221 >>> rosetta_admin_browser.open(package_page)
214222
215Of course in this case, the notice about there being no custom language223Of course in this case, the notice about there being no custom language
216codes talks about a package, not a project.224codes talks about a package, not a project.
217225
218 >>> tag = find_custom_language_codes_link(admin_browser)226 >>> tag = find_custom_language_codes_link(rosetta_admin_browser)
219 >>> print extract_text(tag.renderContents())227 >>> print extract_text(tag.renderContents())
220 If necessary, you may228 If necessary, you may
221 define custom language codes229 define custom language codes
222 for this package.230 for this package.
223231
224 >>> admin_browser.getLink("define custom language codes").click()232 >>> rosetta_admin_browser.getLink("define custom language codes").click()
225 >>> custom_language_codes_page = admin_browser.url233 >>> custom_language_codes_page = rosetta_admin_browser.url
226234
227 >>> tag = find_tag_by_id(admin_browser.contents, 'empty')235 >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty')
228 >>> print extract_text(tag.renderContents())236 >>> print extract_text(tag.renderContents())
229 No custom language codes have been defined.237 No custom language codes have been defined.
230238
231Again, an admin can add a language code.239Again, an admin can add a language code.
232240
233 >>> admin_browser.getLink("Add a custom language code").click()241 >>> rosetta_admin_browser.getLink("Add a custom language code").click()
234 >>> add_page = admin_browser.url242 >>> add_page = rosetta_admin_browser.url
235243
236 >>> admin_browser.getControl("Language code:").value = 'pt-br'244 >>> rosetta_admin_browser.getControl("Language code:").value = 'pt-br'
237 >>> admin_browser.getControl("Language:").value = ['pt_BR']245 >>> rosetta_admin_browser.getControl("Language:").value = ['pt_BR']
238 >>> admin_browser.getControl("Add").click()246 >>> rosetta_admin_browser.getControl("Add").click()
239247
240The language code is displayed.248The language code is displayed.
241249
242 >>> tag = find_tag_by_id(admin_browser.contents, 'nonempty')250 >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'nonempty')
243 >>> print extract_text(tag.renderContents())251 >>> print extract_text(tag.renderContents())
244 bar in distro uses the following custom language codes:252 bar in distro uses the following custom language codes:
245 Code... ...maps to language253 Code... ...maps to language
@@ -248,15 +256,15 @@
248It's also displayed identically on the same package but in another256It's also displayed identically on the same package but in another
249release series of the same distribution.257release series of the same distribution.
250258
251 >>> admin_browser.open(page_in_other_series)259 >>> rosetta_admin_browser.open(page_in_other_series)
252 >>> tag = find_custom_language_codes_link(admin_browser)260 >>> tag = find_custom_language_codes_link(rosetta_admin_browser)
253 >>> print extract_text(tag.renderContents())261 >>> print extract_text(tag.renderContents())
254 If necessary, you may262 If necessary, you may
255 define custom language codes263 define custom language codes
256 for this package.264 for this package.
257265
258 >>> admin_browser.getLink("define custom language codes").click()266 >>> rosetta_admin_browser.getLink("define custom language codes").click()
259 >>> tag = find_tag_by_id(admin_browser.contents, 'nonempty')267 >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'nonempty')
260 >>> print extract_text(tag.renderContents())268 >>> print extract_text(tag.renderContents())
261 bar in distro uses the following custom language codes:269 bar in distro uses the following custom language codes:
262 Code... ...maps to language270 Code... ...maps to language
@@ -265,13 +273,13 @@
265273
266The new code has a link there...274The new code has a link there...
267275
268 >>> admin_browser.getLink("pt-br").click()276 >>> rosetta_admin_browser.getLink("pt-br").click()
269277
270...and can be deleted.278...and can be deleted.
271279
272 >>> admin_browser.getLink("remove custom language code").click()280 >>> rosetta_admin_browser.getLink("remove custom language code").click()
273 >>> admin_browser.getControl("Remove").click()281 >>> rosetta_admin_browser.getControl("Remove").click()
274282
275 >>> tag = find_tag_by_id(admin_browser.contents, 'empty')283 >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty')
276 >>> print extract_text(tag.renderContents())284 >>> print extract_text(tag.renderContents())
277 No custom language codes have been defined.285 No custom language codes have been defined.
278286
=== modified file 'lib/lp/translations/templates/customlanguagecode-index.pt'
--- lib/lp/translations/templates/customlanguagecode-index.pt 2009-11-05 14:45:13 +0000
+++ lib/lp/translations/templates/customlanguagecode-index.pt 2010-04-22 16:33:28 +0000
@@ -26,7 +26,7 @@
2626
27 <div class="portlet">27 <div class="portlet">
28 <ul class="horizontal">28 <ul class="horizontal">
29 <li tal:condition="context/required:launchpad.Admin">29 <li tal:condition="context/required:launchpad.TranslationsAdmin">
30 <a class="remove sprite"30 <a class="remove sprite"
31 tal:attributes="href context/fmt:url/+remove">31 tal:attributes="href context/fmt:url/+remove">
32 remove custom language code32 remove custom language code
3333
=== added file 'lib/lp/translations/templates/customlanguagecode-remove.pt'
--- lib/lp/translations/templates/customlanguagecode-remove.pt 1970-01-01 00:00:00 +0000
+++ lib/lp/translations/templates/customlanguagecode-remove.pt 2010-04-22 16:33:28 +0000
@@ -0,0 +1,18 @@
1<html
2 xmlns="http://www.w3.org/1999/xhtml"
3 xmlns:tal="http://xml.zope.org/namespaces/tal"
4 xmlns:metal="http://xml.zope.org/namespaces/metal"
5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6 metal:use-macro="view/macro:page/main_only"
7 i18n:domain="launchpad">
8 <body>
9 <div metal:fill-slot="main">
10 <div metal:use-macro="context/@@launchpad_form/form">
11 <div metal:fill-slot="extra_info" class="documentDescription">
12 You are going to remove the custom language code
13 '<tal:language-code replace="view/code" />'.
14 </div>
15 </div>
16 </div>
17 </body>
18</html>
019
=== modified file 'lib/lp/translations/templates/customlanguagecodes-index.pt'
--- lib/lp/translations/templates/customlanguagecodes-index.pt 2009-11-05 14:45:13 +0000
+++ lib/lp/translations/templates/customlanguagecodes-index.pt 2010-04-22 16:33:28 +0000
@@ -33,7 +33,8 @@
33 <tr>33 <tr>
34 <th>Code...</th>34 <th>Code...</th>
35 <th>...maps to language</th>35 <th>...maps to language</th>
36 <th tal:condition="context/required:launchpad.Admin"></th>36 <th tal:condition="context/required:launchpad.TranslationsAdmin">
37 </th>
37 </tr>38 </tr>
38 </thead>39 </thead>
39 <tbody>40 <tbody>
@@ -51,7 +52,7 @@
51 &mdash;52 &mdash;
52 </tal:nolanguage>53 </tal:nolanguage>
53 </td>54 </td>
54 <td tal:condition="context/required:launchpad.Admin">55 <td tal:condition="context/required:launchpad.TranslationsAdmin">
55 <a tal:attributes="href entry/fmt:url/+remove"56 <a tal:attributes="href entry/fmt:url/+remove"
56 alt="Remove"57 alt="Remove"
57 title="Remove"58 title="Remove"
@@ -70,7 +71,7 @@
7071
71 <div>72 <div>
72 <a tal:attributes="href context/fmt:url/+add-custom-language-code"73 <a tal:attributes="href context/fmt:url/+add-custom-language-code"
73 tal:condition="context/required:launchpad.Admin"74 tal:condition="context/required:launchpad.TranslationsAdmin"
74 class="add sprite">75 class="add sprite">
75 Add a custom language code76 Add a custom language code
76 </a>77 </a>
7778
=== modified file 'lib/lp/translations/templates/product-portlet-translatables.pt'
--- lib/lp/translations/templates/product-portlet-translatables.pt 2009-11-17 10:17:34 +0000
+++ lib/lp/translations/templates/product-portlet-translatables.pt 2010-04-22 16:33:28 +0000
@@ -65,7 +65,7 @@
65</div>65</div>
6666
67<div class="portlet"67<div class="portlet"
68 tal:condition="context/required:launchpad.Admin"68 tal:condition="context/required:launchpad.TranslationsAdmin"
69 id="custom-language-codes">69 id="custom-language-codes">
70 If necessary, you may70 If necessary, you may
71 <a tal:attributes="href context/fmt:url/+custom-language-codes"71 <a tal:attributes="href context/fmt:url/+custom-language-codes"
7272
=== modified file 'lib/lp/translations/templates/sourcepackage-translations.pt'
--- lib/lp/translations/templates/sourcepackage-translations.pt 2009-11-17 10:17:34 +0000
+++ lib/lp/translations/templates/sourcepackage-translations.pt 2010-04-22 16:33:28 +0000
@@ -39,7 +39,7 @@
39 <a tal:attributes="href context/menu:navigation/download/url">39 <a tal:attributes="href context/menu:navigation/download/url">
40 download a full tarball</a> with translations.40 download a full tarball</a> with translations.
41 </p>41 </p>
42 <p tal:condition="context/required:launchpad.Admin"42 <p tal:condition="context/distribution_sourcepackage/required:launchpad.TranslationsAdmin"
43 id="custom-language-codes">43 id="custom-language-codes">
44 If necessary, you may44 If necessary, you may
45 <a tal:attributes="href context/distribution_sourcepackage/fmt:url/+custom-language-codes"45 <a tal:attributes="href context/distribution_sourcepackage/fmt:url/+custom-language-codes"