Merge lp:~danilo/launchpad/bug-458036 into lp:launchpad

Proposed by Данило Шеган
Status: Merged
Approved by: Muharem Hrnjadovic
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~danilo/launchpad/bug-458036
Merge into: lp:launchpad
Diff against target: 224 lines
8 files modified
lib/lp/translations/browser/configure.zcml (+2/-2)
lib/lp/translations/browser/distroseries.py (+0/-3)
lib/lp/translations/browser/productseries.py (+0/-5)
lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt (+10/-11)
lib/lp/translations/stories/productseries/xx-productseries-templates.txt (+7/-14)
lib/lp/translations/templates/distroseries-translations.pt (+3/-3)
lib/lp/translations/templates/object-templates.pt (+13/-7)
lib/lp/translations/templates/productseries-translations.pt (+3/-3)
To merge this branch: bzr merge lp:~danilo/launchpad/bug-458036
Reviewer Review Type Date Requested Status
Muharem Hrnjadovic (community) Approve
Review via email: mp+13787@code.launchpad.net

Commit message

Allow everyone to access full template listings for ProductSeries and DistroSeries pages.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

= Bug #458036 =

We've limited access to +templates pages for no particular reason to
product/distro admins. There's no reason these pages couldn't be
completely public (actually, there are many reasons they should be).

== Implementation details ==

Change permissions from launchpad.Edit to zope.Public for the views,
and modify the page templates to show links appropriately (since they
can't assume someone has at least launchpad.Edit on that page anymore).

== Tests ==

bin/test -vvt distroseries-templates.txt -t productseries-templates.txt

== Demo and Q/A ==

Dev:

 Log in as <email address hidden>:test and go to:

   https://translations.launchpad.dev/evolution/trunk/
   https://translations.launchpad.dev/ubuntu/hoary/

 Look for 'full listing of templates' link that should take you to:

   https://translations.launchpad.dev/evolution/trunk/+templates
   https://translations.launchpad.dev/ubuntu/hoary/+templates

 Log in as <email address hidden>:test and go to the same pages as above.
 The only difference is what editing links are shown (i.e. just
 "Download" on Ubuntu pages, no "Administrate" on Evolution pages).

Edge:

   https://translations.edge.launchpad.net/limewire/trunk/
   https://translations.edge.launchpad.net/ubuntu/karmic/

= Launchpad lint =

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

Linting changed files:
  lib/lp/translations/templates/object-templates.pt
  lib/lp/translations/templates/distroseries-translations.pt
  lib/lp/translations/browser/configure.zcml
  lib/lp/translations/browser/distroseries.py
  lib/lp/translations/stories/productseries/xx-productseries-templates.txt
  lib/lp/translations/templates/productseries-translations.pt
  lib/lp/translations/browser/productseries.py
  lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt

Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

This looks good, approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/browser/configure.zcml'
2--- lib/lp/translations/browser/configure.zcml 2009-09-28 09:46:35 +0000
3+++ lib/lp/translations/browser/configure.zcml 2009-10-22 14:25:21 +0000
4@@ -672,7 +672,7 @@
5 for="lp.registry.interfaces.productseries.IProductSeries"
6 name="+templates"
7 class="lp.translations.browser.productseries.ProductSeriesTemplatesView"
8- permission="launchpad.Edit"
9+ permission="zope.Public"
10 template="../templates/object-templates.pt"
11 layer="canonical.launchpad.layers.TranslationsLayer"/>
12 <browser:page
13@@ -943,7 +943,7 @@
14 <browser:page
15 for="lp.registry.interfaces.distroseries.IDistroSeries"
16 class="lp.translations.browser.distroseries.DistroSeriesTemplatesView"
17- permission="launchpad.Edit"
18+ permission="zope.Public"
19 layer="canonical.launchpad.layers.TranslationsLayer"
20 name="+templates"
21 template="../templates/object-templates.pt" />
22
23=== modified file 'lib/lp/translations/browser/distroseries.py'
24--- lib/lp/translations/browser/distroseries.py 2009-09-17 14:29:22 +0000
25+++ lib/lp/translations/browser/distroseries.py 2009-10-22 14:25:21 +0000
26@@ -169,9 +169,6 @@
27 potemplateset = getUtility(IPOTemplateSet)
28 return potemplateset.getSubset(distroseries=self.context)
29
30- def can_administer(self, template):
31- return check_permission('launchpad.Admin', template)
32-
33
34 class DistroSeriesView(LaunchpadView, TranslationsMixin):
35
36
37=== modified file 'lib/lp/translations/browser/productseries.py'
38--- lib/lp/translations/browser/productseries.py 2009-09-17 12:45:52 +0000
39+++ lib/lp/translations/browser/productseries.py 2009-10-22 14:25:21 +0000
40@@ -36,7 +36,6 @@
41 LaunchpadView,
42 Link,
43 NavigationMenu)
44-from canonical.launchpad.webapp.authorization import check_permission
45 from canonical.launchpad.webapp.menu import structured
46 from canonical.widgets.itemswidgets import (
47 LaunchpadRadioWidgetWithDescription)
48@@ -489,10 +488,6 @@
49 potemplateset = getUtility(IPOTemplateSet)
50 return potemplateset.getSubset(productseries=self.context)
51
52- def can_administer(self, template):
53- """Can the user administer the template?"""
54- return check_permission('launchpad.Admin', template)
55-
56
57 class LinkTranslationsBranchView(LaunchpadEditFormView):
58 """View to set the series' translations export branch."""
59
60=== modified file 'lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt'
61--- lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt 2009-09-14 13:54:29 +0000
62+++ lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt 2009-10-22 14:25:21 +0000
63@@ -7,24 +7,23 @@
64
65 == Getting there ==
66
67-The view is only visible to the owner of the DistroSeries and administrators.
68+To get to the listing of all templates, one needs to use the link
69+from the distribution series translations page.
70
71 >>> user_browser.open(
72 ... 'http://translations.launchpad.dev/ubuntu/hoary')
73- >>> user_browser.getLink('full list of templates')
74- Traceback (most recent call last):
75- ...
76- LinkNotFoundError
77-
78- >>> admin_browser.open(
79- ... 'http://translations.launchpad.dev/ubuntu/hoary')
80- >>> admin_browser.getLink('full list of templates').click()
81- >>> print admin_browser.url
82+ >>> user_browser.getLink('full list of templates').click()
83+ >>> print user_browser.url
84 http://translations.launchpad.dev/ubuntu/hoary/+templates
85
86-
87 == The templates table ==
88
89+Administrator can see all editing options.
90+
91+ >>> admin_browser.open(
92+ ... 'http://translations.launchpad.dev/ubuntu/hoary')
93+ >>> admin_browser.getLink('full list of templates').click()
94+
95 The page shows a table of all templates and links to their subpages.
96
97 >>> table = find_tag_by_id(admin_browser.contents, 'templates_table')
98
99=== modified file 'lib/lp/translations/stories/productseries/xx-productseries-templates.txt'
100--- lib/lp/translations/stories/productseries/xx-productseries-templates.txt 2009-09-14 19:00:45 +0000
101+++ lib/lp/translations/stories/productseries/xx-productseries-templates.txt 2009-10-22 14:25:21 +0000
102@@ -7,20 +7,13 @@
103
104 == Getting there ==
105
106-The view is only visible to the owner of the ProductSeries and administrators.
107+To get to the listing of all templates, one needs to use the link
108+from the product series translations page.
109
110 >>> user_browser.open(
111 ... 'http://translations.launchpad.dev/evolution/trunk')
112- >>> user_browser.getLink('full list of templates')
113- Traceback (most recent call last):
114- ...
115- LinkNotFoundError
116-
117- >>> browser = setupBrowser('Basic test@canonical.com:test')
118- >>> browser.open(
119- ... 'http://translations.launchpad.dev/evolution/trunk')
120- >>> browser.getLink('full list of templates').click()
121- >>> print browser.url
122+ >>> user_browser.getLink('full list of templates').click()
123+ >>> print user_browser.url
124 http://translations.launchpad.dev/evolution/trunk/+templates
125
126
127@@ -28,11 +21,11 @@
128
129 The page shows a table of all templates and links to their subpages.
130
131- >>> table = find_tag_by_id(browser.contents, 'templates_table')
132+ >>> table = find_tag_by_id(user_browser.contents, 'templates_table')
133 >>> print extract_text(table)
134 Template name Actions
135- evolution-2.2 Edit Upload Download
136- evolution-2.2-test Edit Upload Download
137+ evolution-2.2 Download
138+ evolution-2.2-test Download
139
140 If an administrator views this page, links to the templates admin page are
141 shown, too.
142
143=== modified file 'lib/lp/translations/templates/distroseries-translations.pt'
144--- lib/lp/translations/templates/distroseries-translations.pt 2009-09-25 16:07:06 +0000
145+++ lib/lp/translations/templates/distroseries-translations.pt 2009-10-22 14:25:21 +0000
146@@ -49,10 +49,10 @@
147 tal:content="string:${context/displayname} import queue">
148 import queue</a>.
149 </p>
150- <p tal:condition="context/required:launchpad.Edit">
151- To manage all the translation templates in
152+ <p>
153+ To see all the translation templates in
154 <tal:series replace="context/displayname">Hoary</tal:series>,
155- see the
156+ go to the
157 <a tal:attributes="href context/menu:navigation/templates/url">
158 full list of templates</a>.
159 </p>
160
161=== modified file 'lib/lp/translations/templates/object-templates.pt'
162--- lib/lp/translations/templates/object-templates.pt 2009-09-25 16:07:06 +0000
163+++ lib/lp/translations/templates/object-templates.pt 2009-10-22 14:25:21 +0000
164@@ -75,7 +75,9 @@
165 <th tal:condition="view/is_distroseries"
166 class="sourcepackage_column">Source package</th>
167 <th class="template_column">Template name</th>
168- <th class="actions_column">Actions</th>
169+ <th class="actions_column"
170+ tal:condition="context/required:launchpad.AnyPerson">
171+ Actions</th>
172 </tr>
173 </thead>
174 <tbody>
175@@ -86,21 +88,25 @@
176 </td>
177 <td class="template_column"><a tal:attributes="href template/fmt:url"
178 tal:content="template/name">Template name</a></td>
179- <td class="actions_column">
180+ <td class="actions_column"
181+ tal:condition="context/required:launchpad.AnyPerson">
182 <div class="template_links">
183+ <tal:maintainer condition="template/required:launchpad.Edit">
184 <a tal:attributes="href string:${template/fmt:url}/+edit;
185 title string:Edit ${template/name}'s details">
186 <img src="/@@/edit" />&nbsp;Edit</a>
187 <a tal:attributes="href string:${template/fmt:url}/+upload;
188 title string:Upload translations to ${template/name}">
189 <img src="/@@/add" />&nbsp;Upload</a>
190- <a tal:attributes="href string:${template/fmt:url}/+export;
191- title string:Download translations from ${template/name}">
192- <img src="/@@/download" />&nbsp;Download</a>
193- <a tal:condition="python:view.can_administer(template)"
194- tal:attributes="href string:${template/fmt:url}/+admin;
195+ </tal:maintainer>
196+ <a tal:attributes="href string:${template/fmt:url}/+export;
197+ title string:Download translations from ${template/name}">
198+ <img src="/@@/download" />&nbsp;Download</a>
199+ <tal:admin condition="template/required:launchpad.Admin">
200+ <a tal:attributes="href string:${template/fmt:url}/+admin;
201 title string:Administer ${template/name}">
202 <img src="/@@/edit" />&nbsp;Administer</a>
203+ </tal:admin>
204 </div>
205 </td>
206 </tr>
207
208=== modified file 'lib/lp/translations/templates/productseries-translations.pt'
209--- lib/lp/translations/templates/productseries-translations.pt 2009-09-25 17:21:00 +0000
210+++ lib/lp/translations/templates/productseries-translations.pt 2009-10-22 14:25:21 +0000
211@@ -66,10 +66,10 @@
212 <a tal:attributes="href context/menu:navigation/imports/url">
213 import queue</a>.
214 </p>
215- <p tal:condition="context/required:launchpad.Edit">
216- To manage all the translation templates in
217+ <p>
218+ To see all the translation templates in
219 <tal:series replace="context/displayname">trunk</tal:series>,
220- see the
221+ go to the
222 <a tal:attributes="href context/menu:navigation/templates/url">
223 full list of templates</a>.
224 </p>