Merge lp:~adiroiban/launchpad/bug-487137 into lp:launchpad
- bug-487137
- Merge into devel
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 |
Related bugs: |
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.
Allow Launchpad Admin and Rosetta Admin launchpad.
== 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-
== Demo and Q/A ==
Login as Rosetta Administrator.
Go to a product or sourcepackage page:
https:/
https:/
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
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
Adi Roiban (adiroiban) wrote : | # |
> 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-
>
> Running the test results in a failure:
> http://
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:/
> > https:/
> >
> > 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 IHasCustomLanga
> 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/
> > --- lib/canonical/
> > +++ lib/canonical/
> > @@ -112,6 +112,8 @@
> > from lp.blueprints.
> > ISprintSpecific
> > from lp.registry.
> > +from lp.translations
> > + ICustomLanguage
> > from lp.translations
> > ITranslationGroup, ITranslationGro
> > from lp.translations
> > @@ -1652,6 +1654,28 @@
> > usedfor = ILanguage
> >
> >
> > +class AdminCustomLang
> > + """Controls administration of custom language codes.
> > +
> > + Rosetta expters and Launchpad administrators can admister custom
> language
>
> s/expters/experts
> s/admister/
Fixed.
> > + codes.
> > + """
> > +
> > + permission = 'launchpad.
> > + usedfor = IHasCustomLangu
> > +
> > +
> > +class AdminCustomLang
> > + """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
> ...
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.
Данило Шеган (danilo) wrote : | # |
Henning has picked up this branch and massaged it for landing. Thanks Adi for the work on it so far :)
Preview Diff
1 | === modified file 'lib/canonical/launchpad/security.py' | |||
2 | --- lib/canonical/launchpad/security.py 2010-04-20 08:01:41 +0000 | |||
3 | +++ lib/canonical/launchpad/security.py 2010-04-22 16:33:28 +0000 | |||
4 | @@ -112,6 +112,8 @@ | |||
5 | 112 | from lp.blueprints.interfaces.sprintspecification import ( | 112 | from lp.blueprints.interfaces.sprintspecification import ( |
6 | 113 | ISprintSpecification) | 113 | ISprintSpecification) |
7 | 114 | from lp.registry.interfaces.teammembership import ITeamMembership | 114 | from lp.registry.interfaces.teammembership import ITeamMembership |
8 | 115 | from lp.translations.interfaces.customlanguagecode import ( | ||
9 | 116 | ICustomLanguageCode, IHasCustomLanguageCodes) | ||
10 | 115 | from lp.translations.interfaces.translationgroup import ( | 117 | from lp.translations.interfaces.translationgroup import ( |
11 | 116 | ITranslationGroup, ITranslationGroupSet) | 118 | ITranslationGroup, ITranslationGroupSet) |
12 | 117 | from lp.translations.interfaces.translationimportqueue import ( | 119 | from lp.translations.interfaces.translationimportqueue import ( |
13 | @@ -1652,6 +1654,28 @@ | |||
14 | 1652 | usedfor = ILanguage | 1654 | usedfor = ILanguage |
15 | 1653 | 1655 | ||
16 | 1654 | 1656 | ||
17 | 1657 | class AdminCustomLanguageCodes(OnlyRosettaExpertsAndAdmins): | ||
18 | 1658 | """Controls administration of custom language codes. | ||
19 | 1659 | |||
20 | 1660 | Rosetta experts and Launchpad administrators can administer custom | ||
21 | 1661 | language codes. | ||
22 | 1662 | """ | ||
23 | 1663 | |||
24 | 1664 | permission = 'launchpad.TranslationsAdmin' | ||
25 | 1665 | usedfor = IHasCustomLanguageCodes | ||
26 | 1666 | |||
27 | 1667 | |||
28 | 1668 | class AdminCustomLanguageCode(OnlyRosettaExpertsAndAdmins): | ||
29 | 1669 | """Controls administration for a custom language code. | ||
30 | 1670 | |||
31 | 1671 | Rosetta experts and Launchpad administrators can administer a custom | ||
32 | 1672 | language code. | ||
33 | 1673 | """ | ||
34 | 1674 | |||
35 | 1675 | permission = 'launchpad.TranslationsAdmin' | ||
36 | 1676 | usedfor = ICustomLanguageCode | ||
37 | 1677 | |||
38 | 1678 | |||
39 | 1655 | class AccessBranch(AuthorizationBase): | 1679 | class AccessBranch(AuthorizationBase): |
40 | 1656 | """Controls visibility of branches. | 1680 | """Controls visibility of branches. |
41 | 1657 | 1681 | ||
42 | 1658 | 1682 | ||
43 | === modified file 'lib/lp/translations/browser/configure.zcml' | |||
44 | --- lib/lp/translations/browser/configure.zcml 2010-04-19 08:11:52 +0000 | |||
45 | +++ lib/lp/translations/browser/configure.zcml 2010-04-22 16:33:28 +0000 | |||
46 | @@ -1001,9 +1001,9 @@ | |||
47 | 1001 | <browser:page | 1001 | <browser:page |
48 | 1002 | name="+remove" | 1002 | name="+remove" |
49 | 1003 | for="lp.translations.interfaces.customlanguagecode.ICustomLanguageCode" | 1003 | for="lp.translations.interfaces.customlanguagecode.ICustomLanguageCode" |
51 | 1004 | permission="launchpad.Admin" | 1004 | permission="launchpad.TranslationsAdmin" |
52 | 1005 | class="lp.translations.browser.customlanguagecode.CustomLanguageCodeRemoveView" | 1005 | class="lp.translations.browser.customlanguagecode.CustomLanguageCodeRemoveView" |
54 | 1006 | template="../../app/templates/generic-edit.pt" | 1006 | template="../templates/customlanguagecode-remove.pt" |
55 | 1007 | layer="canonical.launchpad.layers.TranslationsLayer"/> | 1007 | layer="canonical.launchpad.layers.TranslationsLayer"/> |
56 | 1008 | 1008 | ||
57 | 1009 | <!-- IHasCustomLanguageCodes --> | 1009 | <!-- IHasCustomLanguageCodes --> |
58 | @@ -1021,7 +1021,7 @@ | |||
59 | 1021 | layer="canonical.launchpad.layers.TranslationsLayer" | 1021 | layer="canonical.launchpad.layers.TranslationsLayer" |
60 | 1022 | class="lp.translations.browser.customlanguagecode.CustomLanguageCodeAddView" | 1022 | class="lp.translations.browser.customlanguagecode.CustomLanguageCodeAddView" |
61 | 1023 | template="../templates/customlanguagecode-add.pt" | 1023 | template="../templates/customlanguagecode-add.pt" |
63 | 1024 | permission="launchpad.Admin"/> | 1024 | permission="launchpad.TranslationsAdmin"/> |
64 | 1025 | 1025 | ||
65 | 1026 | </facet> | 1026 | </facet> |
66 | 1027 | </configure> | 1027 | </configure> |
67 | 1028 | 1028 | ||
68 | === modified file 'lib/lp/translations/browser/customlanguagecode.py' | |||
69 | --- lib/lp/translations/browser/customlanguagecode.py 2009-11-13 16:18:54 +0000 | |||
70 | +++ lib/lp/translations/browser/customlanguagecode.py 2010-04-22 16:33:28 +0000 | |||
71 | @@ -11,7 +11,7 @@ | |||
72 | 11 | 'CustomLanguageCodeView', | 11 | 'CustomLanguageCodeView', |
73 | 12 | 'HasCustomLanguageCodesNavigation', | 12 | 'HasCustomLanguageCodesNavigation', |
74 | 13 | 'HasCustomLanguageCodesTraversalMixin', | 13 | 'HasCustomLanguageCodesTraversalMixin', |
76 | 14 | ] | 14 | ] |
77 | 15 | 15 | ||
78 | 16 | 16 | ||
79 | 17 | import re | 17 | import re |
80 | 18 | 18 | ||
81 | === modified file 'lib/lp/translations/stories/standalone/custom-language-codes.txt' | |||
82 | --- lib/lp/translations/stories/standalone/custom-language-codes.txt 2010-03-11 20:54:36 +0000 | |||
83 | +++ lib/lp/translations/stories/standalone/custom-language-codes.txt 2010-04-22 16:33:28 +0000 | |||
84 | @@ -11,7 +11,6 @@ | |||
85 | 11 | Custom language codes are attached to either a product or a source | 11 | Custom language codes are attached to either a product or a source |
86 | 12 | package. | 12 | package. |
87 | 13 | 13 | ||
88 | 14 | >>> import re | ||
89 | 15 | >>> from zope.component import getUtility | 14 | >>> from zope.component import getUtility |
90 | 16 | >>> from zope.security.proxy import removeSecurityProxy | 15 | >>> from zope.security.proxy import removeSecurityProxy |
91 | 17 | >>> from canonical.launchpad.interfaces.launchpad import ( | 16 | >>> from canonical.launchpad.interfaces.launchpad import ( |
92 | @@ -35,9 +34,10 @@ | |||
93 | 35 | >>> logout() | 34 | >>> logout() |
94 | 36 | 35 | ||
95 | 37 | >>> owner_browser = setupBrowser("Basic o@example.com:test") | 36 | >>> owner_browser = setupBrowser("Basic o@example.com:test") |
96 | 37 | >>> rosetta_admin_browser = setupRosettaExpertBrowser() | ||
97 | 38 | 38 | ||
100 | 39 | An administrator sees the link to the custom language codes on a | 39 | A Launchpad administrator or Rosetta expert sees the link to the custom |
101 | 40 | project's main translations page. | 40 | language codes on a project's main translations page. |
102 | 41 | 41 | ||
103 | 42 | >>> admin_browser.open(product_page) | 42 | >>> admin_browser.open(product_page) |
104 | 43 | >>> tag = find_custom_language_codes_link(admin_browser) | 43 | >>> tag = find_custom_language_codes_link(admin_browser) |
105 | @@ -46,10 +46,17 @@ | |||
106 | 46 | define custom language codes | 46 | define custom language codes |
107 | 47 | for this project. | 47 | for this project. |
108 | 48 | 48 | ||
109 | 49 | >>> rosetta_admin_browser.open(product_page) | ||
110 | 50 | >>> tag = find_custom_language_codes_link(rosetta_admin_browser) | ||
111 | 51 | >>> print extract_text(tag.renderContents()) | ||
112 | 52 | If necessary, you may | ||
113 | 53 | define custom language codes | ||
114 | 54 | for this project. | ||
115 | 55 | |||
116 | 49 | The link goes to the custom language codes management page. | 56 | The link goes to the custom language codes management page. |
117 | 50 | 57 | ||
120 | 51 | >>> admin_browser.getLink("define custom language codes").click() | 58 | >>> rosetta_admin_browser.getLink("define custom language codes").click() |
121 | 52 | >>> custom_language_codes_page = admin_browser.url | 59 | >>> custom_language_codes_page = rosetta_admin_browser.url |
122 | 53 | 60 | ||
123 | 54 | Non-admins, even the project's owner, don't see this link. We do not | 61 | Non-admins, even the project's owner, don't see this link. We do not |
124 | 55 | advertise this feature, since the proper solution is generally to use | 62 | advertise this feature, since the proper solution is generally to use |
125 | @@ -61,26 +68,26 @@ | |||
126 | 61 | 68 | ||
127 | 62 | Initially the page shows no custom language codes for the project. | 69 | Initially the page shows no custom language codes for the project. |
128 | 63 | 70 | ||
130 | 64 | >>> tag = find_tag_by_id(admin_browser.contents, 'empty') | 71 | >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty') |
131 | 65 | >>> print extract_text(tag.renderContents()) | 72 | >>> print extract_text(tag.renderContents()) |
132 | 66 | No custom language codes have been defined. | 73 | No custom language codes have been defined. |
133 | 67 | 74 | ||
134 | 68 | The admin can add a custom language code. | 75 | The admin can add a custom language code. |
135 | 69 | 76 | ||
138 | 70 | >>> admin_browser.getLink("Add a custom language code").click() | 77 | >>> rosetta_admin_browser.getLink("Add a custom language code").click() |
139 | 71 | >>> add_page = admin_browser.url | 78 | >>> add_page = rosetta_admin_browser.url |
140 | 72 | 79 | ||
144 | 73 | >>> admin_browser.getControl("Language code:").value = 'no' | 80 | >>> rosetta_admin_browser.getControl("Language code:").value = 'no' |
145 | 74 | >>> admin_browser.getControl("Language:").value = ['nn'] | 81 | >>> rosetta_admin_browser.getControl("Language:").value = ['nn'] |
146 | 75 | >>> admin_browser.getControl("Add").click() | 82 | >>> rosetta_admin_browser.getControl("Add").click() |
147 | 76 | 83 | ||
148 | 77 | This leads back to the custom language codes overview, where the new | 84 | This leads back to the custom language codes overview, where the new |
149 | 78 | code is now shown. | 85 | code is now shown. |
150 | 79 | 86 | ||
152 | 80 | >>> admin_browser.url == custom_language_codes_page | 87 | >>> rosetta_admin_browser.url == custom_language_codes_page |
153 | 81 | True | 88 | True |
154 | 82 | 89 | ||
156 | 83 | >>> tag = find_tag_by_id(admin_browser.contents, 'nonempty') | 90 | >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'nonempty') |
157 | 84 | >>> print extract_text(tag.renderContents()) | 91 | >>> print extract_text(tag.renderContents()) |
158 | 85 | Foo uses the following custom language codes: | 92 | Foo uses the following custom language codes: |
159 | 86 | Code... ...maps to language | 93 | Code... ...maps to language |
160 | @@ -89,8 +96,8 @@ | |||
161 | 89 | There is an overview page for the custom code, though there's not much | 96 | There is an overview page for the custom code, though there's not much |
162 | 90 | to see there. | 97 | to see there. |
163 | 91 | 98 | ||
166 | 92 | >>> admin_browser.getLink("no").click() | 99 | >>> rosetta_admin_browser.getLink("no").click() |
167 | 93 | >>> main = find_main_content(admin_browser.contents) | 100 | >>> main = find_main_content(rosetta_admin_browser.contents) |
168 | 94 | >>> print extract_text(main.renderContents()) | 101 | >>> print extract_text(main.renderContents()) |
169 | 95 | Foo Translations Custom language code ...no... | 102 | Foo Translations Custom language code ...no... |
170 | 96 | For Foo, uploads with the language code | 103 | For Foo, uploads with the language code |
171 | @@ -102,26 +109,27 @@ | |||
172 | 102 | 109 | ||
173 | 103 | The overview page leads back to the custom language codes overview. | 110 | The overview page leads back to the custom language codes overview. |
174 | 104 | 111 | ||
178 | 105 | >>> code_page = admin_browser.url | 112 | >>> code_page = rosetta_admin_browser.url |
179 | 106 | >>> admin_browser.getLink("custom language codes overview").click() | 113 | >>> rosetta_admin_browser.getLink( |
180 | 107 | >>> admin_browser.url == custom_language_codes_page | 114 | ... "custom language codes overview").click() |
181 | 115 | >>> rosetta_admin_browser.url == custom_language_codes_page | ||
182 | 108 | True | 116 | True |
183 | 109 | 117 | ||
185 | 110 | >>> admin_browser.open(code_page) | 118 | >>> rosetta_admin_browser.open(code_page) |
186 | 111 | 119 | ||
187 | 112 | There is also a link for removing codes. The admin follows the link and | 120 | There is also a link for removing codes. The admin follows the link and |
188 | 113 | removes the "no" custom language code. | 121 | removes the "no" custom language code. |
189 | 114 | 122 | ||
193 | 115 | >>> admin_browser.getLink("remove custom language code").click() | 123 | >>> rosetta_admin_browser.getLink("remove custom language code").click() |
194 | 116 | >>> remove_page = admin_browser.url | 124 | >>> remove_page = rosetta_admin_browser.url |
195 | 117 | >>> admin_browser.getControl("Remove").click() | 125 | >>> rosetta_admin_browser.getControl("Remove").click() |
196 | 118 | 126 | ||
197 | 119 | This leads back to the overview page. | 127 | This leads back to the overview page. |
198 | 120 | 128 | ||
200 | 121 | >>> admin_browser.url == custom_language_codes_page | 129 | >>> rosetta_admin_browser.url == custom_language_codes_page |
201 | 122 | True | 130 | True |
202 | 123 | 131 | ||
204 | 124 | >>> tag = find_tag_by_id(admin_browser.contents, 'empty') | 132 | >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty') |
205 | 125 | >>> print extract_text(tag.renderContents()) | 133 | >>> print extract_text(tag.renderContents()) |
206 | 126 | No custom language codes have been defined. | 134 | No custom language codes have been defined. |
207 | 127 | 135 | ||
208 | @@ -155,10 +163,10 @@ | |||
209 | 155 | And naturally, if an admin creates a custom language code again, a | 163 | And naturally, if an admin creates a custom language code again, a |
210 | 156 | non-admin can't remove it. | 164 | non-admin can't remove it. |
211 | 157 | 165 | ||
216 | 158 | >>> admin_browser.open(add_page) | 166 | >>> rosetta_admin_browser.open(add_page) |
217 | 159 | >>> admin_browser.getControl("Language code:").value = 'no' | 167 | >>> rosetta_admin_browser.getControl("Language code:").value = 'no' |
218 | 160 | >>> admin_browser.getControl("Language:").value = ['nn'] | 168 | >>> rosetta_admin_browser.getControl("Language:").value = ['nn'] |
219 | 161 | >>> admin_browser.getControl("Add").click() | 169 | >>> rosetta_admin_browser.getControl("Add").click() |
220 | 162 | 170 | ||
221 | 163 | >>> owner_browser.open(custom_language_codes_page) | 171 | >>> owner_browser.open(custom_language_codes_page) |
222 | 164 | >>> tag = find_tag_by_id(owner_browser.contents, 'nonempty') | 172 | >>> tag = find_tag_by_id(owner_browser.contents, 'nonempty') |
223 | @@ -210,36 +218,36 @@ | |||
224 | 210 | ... rootsite="translations") | 218 | ... rootsite="translations") |
225 | 211 | >>> logout() | 219 | >>> logout() |
226 | 212 | 220 | ||
228 | 213 | >>> admin_browser.open(package_page) | 221 | >>> rosetta_admin_browser.open(package_page) |
229 | 214 | 222 | ||
230 | 215 | Of course in this case, the notice about there being no custom language | 223 | Of course in this case, the notice about there being no custom language |
231 | 216 | codes talks about a package, not a project. | 224 | codes talks about a package, not a project. |
232 | 217 | 225 | ||
234 | 218 | >>> tag = find_custom_language_codes_link(admin_browser) | 226 | >>> tag = find_custom_language_codes_link(rosetta_admin_browser) |
235 | 219 | >>> print extract_text(tag.renderContents()) | 227 | >>> print extract_text(tag.renderContents()) |
236 | 220 | If necessary, you may | 228 | If necessary, you may |
237 | 221 | define custom language codes | 229 | define custom language codes |
238 | 222 | for this package. | 230 | for this package. |
239 | 223 | 231 | ||
242 | 224 | >>> admin_browser.getLink("define custom language codes").click() | 232 | >>> rosetta_admin_browser.getLink("define custom language codes").click() |
243 | 225 | >>> custom_language_codes_page = admin_browser.url | 233 | >>> custom_language_codes_page = rosetta_admin_browser.url |
244 | 226 | 234 | ||
246 | 227 | >>> tag = find_tag_by_id(admin_browser.contents, 'empty') | 235 | >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty') |
247 | 228 | >>> print extract_text(tag.renderContents()) | 236 | >>> print extract_text(tag.renderContents()) |
248 | 229 | No custom language codes have been defined. | 237 | No custom language codes have been defined. |
249 | 230 | 238 | ||
250 | 231 | Again, an admin can add a language code. | 239 | Again, an admin can add a language code. |
251 | 232 | 240 | ||
254 | 233 | >>> admin_browser.getLink("Add a custom language code").click() | 241 | >>> rosetta_admin_browser.getLink("Add a custom language code").click() |
255 | 234 | >>> add_page = admin_browser.url | 242 | >>> add_page = rosetta_admin_browser.url |
256 | 235 | 243 | ||
260 | 236 | >>> admin_browser.getControl("Language code:").value = 'pt-br' | 244 | >>> rosetta_admin_browser.getControl("Language code:").value = 'pt-br' |
261 | 237 | >>> admin_browser.getControl("Language:").value = ['pt_BR'] | 245 | >>> rosetta_admin_browser.getControl("Language:").value = ['pt_BR'] |
262 | 238 | >>> admin_browser.getControl("Add").click() | 246 | >>> rosetta_admin_browser.getControl("Add").click() |
263 | 239 | 247 | ||
264 | 240 | The language code is displayed. | 248 | The language code is displayed. |
265 | 241 | 249 | ||
267 | 242 | >>> tag = find_tag_by_id(admin_browser.contents, 'nonempty') | 250 | >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'nonempty') |
268 | 243 | >>> print extract_text(tag.renderContents()) | 251 | >>> print extract_text(tag.renderContents()) |
269 | 244 | bar in distro uses the following custom language codes: | 252 | bar in distro uses the following custom language codes: |
270 | 245 | Code... ...maps to language | 253 | Code... ...maps to language |
271 | @@ -248,15 +256,15 @@ | |||
272 | 248 | It's also displayed identically on the same package but in another | 256 | It's also displayed identically on the same package but in another |
273 | 249 | release series of the same distribution. | 257 | release series of the same distribution. |
274 | 250 | 258 | ||
277 | 251 | >>> admin_browser.open(page_in_other_series) | 259 | >>> rosetta_admin_browser.open(page_in_other_series) |
278 | 252 | >>> tag = find_custom_language_codes_link(admin_browser) | 260 | >>> tag = find_custom_language_codes_link(rosetta_admin_browser) |
279 | 253 | >>> print extract_text(tag.renderContents()) | 261 | >>> print extract_text(tag.renderContents()) |
280 | 254 | If necessary, you may | 262 | If necessary, you may |
281 | 255 | define custom language codes | 263 | define custom language codes |
282 | 256 | for this package. | 264 | for this package. |
283 | 257 | 265 | ||
286 | 258 | >>> admin_browser.getLink("define custom language codes").click() | 266 | >>> rosetta_admin_browser.getLink("define custom language codes").click() |
287 | 259 | >>> tag = find_tag_by_id(admin_browser.contents, 'nonempty') | 267 | >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'nonempty') |
288 | 260 | >>> print extract_text(tag.renderContents()) | 268 | >>> print extract_text(tag.renderContents()) |
289 | 261 | bar in distro uses the following custom language codes: | 269 | bar in distro uses the following custom language codes: |
290 | 262 | Code... ...maps to language | 270 | Code... ...maps to language |
291 | @@ -265,13 +273,13 @@ | |||
292 | 265 | 273 | ||
293 | 266 | The new code has a link there... | 274 | The new code has a link there... |
294 | 267 | 275 | ||
296 | 268 | >>> admin_browser.getLink("pt-br").click() | 276 | >>> rosetta_admin_browser.getLink("pt-br").click() |
297 | 269 | 277 | ||
298 | 270 | ...and can be deleted. | 278 | ...and can be deleted. |
299 | 271 | 279 | ||
302 | 272 | >>> admin_browser.getLink("remove custom language code").click() | 280 | >>> rosetta_admin_browser.getLink("remove custom language code").click() |
303 | 273 | >>> admin_browser.getControl("Remove").click() | 281 | >>> rosetta_admin_browser.getControl("Remove").click() |
304 | 274 | 282 | ||
306 | 275 | >>> tag = find_tag_by_id(admin_browser.contents, 'empty') | 283 | >>> tag = find_tag_by_id(rosetta_admin_browser.contents, 'empty') |
307 | 276 | >>> print extract_text(tag.renderContents()) | 284 | >>> print extract_text(tag.renderContents()) |
308 | 277 | No custom language codes have been defined. | 285 | No custom language codes have been defined. |
309 | 278 | 286 | ||
310 | === modified file 'lib/lp/translations/templates/customlanguagecode-index.pt' | |||
311 | --- lib/lp/translations/templates/customlanguagecode-index.pt 2009-11-05 14:45:13 +0000 | |||
312 | +++ lib/lp/translations/templates/customlanguagecode-index.pt 2010-04-22 16:33:28 +0000 | |||
313 | @@ -26,7 +26,7 @@ | |||
314 | 26 | 26 | ||
315 | 27 | <div class="portlet"> | 27 | <div class="portlet"> |
316 | 28 | <ul class="horizontal"> | 28 | <ul class="horizontal"> |
318 | 29 | <li tal:condition="context/required:launchpad.Admin"> | 29 | <li tal:condition="context/required:launchpad.TranslationsAdmin"> |
319 | 30 | <a class="remove sprite" | 30 | <a class="remove sprite" |
320 | 31 | tal:attributes="href context/fmt:url/+remove"> | 31 | tal:attributes="href context/fmt:url/+remove"> |
321 | 32 | remove custom language code | 32 | remove custom language code |
322 | 33 | 33 | ||
323 | === added file 'lib/lp/translations/templates/customlanguagecode-remove.pt' | |||
324 | --- lib/lp/translations/templates/customlanguagecode-remove.pt 1970-01-01 00:00:00 +0000 | |||
325 | +++ lib/lp/translations/templates/customlanguagecode-remove.pt 2010-04-22 16:33:28 +0000 | |||
326 | @@ -0,0 +1,18 @@ | |||
327 | 1 | <html | ||
328 | 2 | xmlns="http://www.w3.org/1999/xhtml" | ||
329 | 3 | xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
330 | 4 | xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
331 | 5 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
332 | 6 | metal:use-macro="view/macro:page/main_only" | ||
333 | 7 | i18n:domain="launchpad"> | ||
334 | 8 | <body> | ||
335 | 9 | <div metal:fill-slot="main"> | ||
336 | 10 | <div metal:use-macro="context/@@launchpad_form/form"> | ||
337 | 11 | <div metal:fill-slot="extra_info" class="documentDescription"> | ||
338 | 12 | You are going to remove the custom language code | ||
339 | 13 | '<tal:language-code replace="view/code" />'. | ||
340 | 14 | </div> | ||
341 | 15 | </div> | ||
342 | 16 | </div> | ||
343 | 17 | </body> | ||
344 | 18 | </html> | ||
345 | 0 | 19 | ||
346 | === modified file 'lib/lp/translations/templates/customlanguagecodes-index.pt' | |||
347 | --- lib/lp/translations/templates/customlanguagecodes-index.pt 2009-11-05 14:45:13 +0000 | |||
348 | +++ lib/lp/translations/templates/customlanguagecodes-index.pt 2010-04-22 16:33:28 +0000 | |||
349 | @@ -33,7 +33,8 @@ | |||
350 | 33 | <tr> | 33 | <tr> |
351 | 34 | <th>Code...</th> | 34 | <th>Code...</th> |
352 | 35 | <th>...maps to language</th> | 35 | <th>...maps to language</th> |
354 | 36 | <th tal:condition="context/required:launchpad.Admin"></th> | 36 | <th tal:condition="context/required:launchpad.TranslationsAdmin"> |
355 | 37 | </th> | ||
356 | 37 | </tr> | 38 | </tr> |
357 | 38 | </thead> | 39 | </thead> |
358 | 39 | <tbody> | 40 | <tbody> |
359 | @@ -51,7 +52,7 @@ | |||
360 | 51 | — | 52 | — |
361 | 52 | </tal:nolanguage> | 53 | </tal:nolanguage> |
362 | 53 | </td> | 54 | </td> |
364 | 54 | <td tal:condition="context/required:launchpad.Admin"> | 55 | <td tal:condition="context/required:launchpad.TranslationsAdmin"> |
365 | 55 | <a tal:attributes="href entry/fmt:url/+remove" | 56 | <a tal:attributes="href entry/fmt:url/+remove" |
366 | 56 | alt="Remove" | 57 | alt="Remove" |
367 | 57 | title="Remove" | 58 | title="Remove" |
368 | @@ -70,7 +71,7 @@ | |||
369 | 70 | 71 | ||
370 | 71 | <div> | 72 | <div> |
371 | 72 | <a tal:attributes="href context/fmt:url/+add-custom-language-code" | 73 | <a tal:attributes="href context/fmt:url/+add-custom-language-code" |
373 | 73 | tal:condition="context/required:launchpad.Admin" | 74 | tal:condition="context/required:launchpad.TranslationsAdmin" |
374 | 74 | class="add sprite"> | 75 | class="add sprite"> |
375 | 75 | Add a custom language code | 76 | Add a custom language code |
376 | 76 | </a> | 77 | </a> |
377 | 77 | 78 | ||
378 | === modified file 'lib/lp/translations/templates/product-portlet-translatables.pt' | |||
379 | --- lib/lp/translations/templates/product-portlet-translatables.pt 2009-11-17 10:17:34 +0000 | |||
380 | +++ lib/lp/translations/templates/product-portlet-translatables.pt 2010-04-22 16:33:28 +0000 | |||
381 | @@ -65,7 +65,7 @@ | |||
382 | 65 | </div> | 65 | </div> |
383 | 66 | 66 | ||
384 | 67 | <div class="portlet" | 67 | <div class="portlet" |
386 | 68 | tal:condition="context/required:launchpad.Admin" | 68 | tal:condition="context/required:launchpad.TranslationsAdmin" |
387 | 69 | id="custom-language-codes"> | 69 | id="custom-language-codes"> |
388 | 70 | If necessary, you may | 70 | If necessary, you may |
389 | 71 | <a tal:attributes="href context/fmt:url/+custom-language-codes" | 71 | <a tal:attributes="href context/fmt:url/+custom-language-codes" |
390 | 72 | 72 | ||
391 | === modified file 'lib/lp/translations/templates/sourcepackage-translations.pt' | |||
392 | --- lib/lp/translations/templates/sourcepackage-translations.pt 2009-11-17 10:17:34 +0000 | |||
393 | +++ lib/lp/translations/templates/sourcepackage-translations.pt 2010-04-22 16:33:28 +0000 | |||
394 | @@ -39,7 +39,7 @@ | |||
395 | 39 | <a tal:attributes="href context/menu:navigation/download/url"> | 39 | <a tal:attributes="href context/menu:navigation/download/url"> |
396 | 40 | download a full tarball</a> with translations. | 40 | download a full tarball</a> with translations. |
397 | 41 | </p> | 41 | </p> |
399 | 42 | <p tal:condition="context/required:launchpad.Admin" | 42 | <p tal:condition="context/distribution_sourcepackage/required:launchpad.TranslationsAdmin" |
400 | 43 | id="custom-language-codes"> | 43 | id="custom-language-codes"> |
401 | 44 | If necessary, you may | 44 | If necessary, you may |
402 | 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" |
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: language- codes
> Adi Roiban has proposed merging lp:~adiroiban/launchpad/bug-487137 into lp:launchpad/devel.
...
>
> == Tests ==<email address hidden>
>
> lp-test custom-
Running the test results in a failure: pastebin. ubuntu. com/420372/
http://
> /translations. launchpad. dev/evolution /translations. launchpad. dev/ubuntu/ +source/ evolution
> == Demo and Q/A ==
>
> Login as Rosetta Administrator.
> Go to a product or sourcepackage page:
>
> https:/
> https:/
>
> 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' launchpad/ security. py 2010-04-18 22:31:40 +0000 launchpad/ security. py 2010-04-22 03:19:15 +0000 interfaces. sprintspecifica tion import ( ation) interfaces. teammembership import ITeamMembership .interfaces. customlanguagec ode import ( Code, IHasCustomLangu ageCodes) .interfaces. translationgrou p import ( upSet) .interfaces. translationimpo rtqueue import ( uageCodes( OnlyRosettaExpe rtsAndAdmins) :
> --- lib/canonical/
> +++ lib/canonical/
> @@ -112,6 +112,8 @@
> from lp.blueprints.
> ISprintSpecific
> from lp.registry.
> +from lp.translations
> + ICustomLanguage
> from lp.translations
> ITranslationGroup, ITranslationGro
> from lp.translations
> @@ -1652,6 +1654,28 @@
> usedfor = ILanguage
>
>
> +class AdminCustomLang
> + """Controls administration of custom language codes.
> +
> + Rosetta expters and Launchpad administrators can admister custom language
s/expters/experts administer
s/admister/
> + codes. TranslationsAdm in' ageCodes uageCode( OnlyRosettaExpe rtsAndAdmins) :
> + """
> +
> + permission = 'launchpad.
> + usedfor = IHasCustomLangu
> +
> +
> +class AdminCustomLang
> + """Controls administration for a custom language code.
> +
> + Rosetta expters and Launchpad administrators can admister a custom
as above.
> + language code. TranslationsAdm in' AuthorizationBa se):
> + """
> +
> + permission = 'launchpad.
> + usedfor = ICustomLanguageCode
> +
> +
> class AccessBranch(
> """Controls visibility of branches.
>
>
> === modified file 'lib/lp/ translations/ stories/ standalone/ custom- language- codes.txt' translations/ stories/ standalone/ custom- language- codes.txt 2010-03-11 20:54:36 +0000 translations/ stories/ standalone/ custom- language- codes.txt 2010-04-22 03:19:15 +0000
> --- lib/lp/
> +++ lib/lp/
....