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
=== modified file 'lib/lp/translations/browser/configure.zcml'
--- lib/lp/translations/browser/configure.zcml 2009-09-28 09:46:35 +0000
+++ lib/lp/translations/browser/configure.zcml 2009-10-22 14:25:21 +0000
@@ -672,7 +672,7 @@
672 for="lp.registry.interfaces.productseries.IProductSeries"672 for="lp.registry.interfaces.productseries.IProductSeries"
673 name="+templates"673 name="+templates"
674 class="lp.translations.browser.productseries.ProductSeriesTemplatesView"674 class="lp.translations.browser.productseries.ProductSeriesTemplatesView"
675 permission="launchpad.Edit"675 permission="zope.Public"
676 template="../templates/object-templates.pt"676 template="../templates/object-templates.pt"
677 layer="canonical.launchpad.layers.TranslationsLayer"/>677 layer="canonical.launchpad.layers.TranslationsLayer"/>
678 <browser:page678 <browser:page
@@ -943,7 +943,7 @@
943 <browser:page943 <browser:page
944 for="lp.registry.interfaces.distroseries.IDistroSeries"944 for="lp.registry.interfaces.distroseries.IDistroSeries"
945 class="lp.translations.browser.distroseries.DistroSeriesTemplatesView"945 class="lp.translations.browser.distroseries.DistroSeriesTemplatesView"
946 permission="launchpad.Edit"946 permission="zope.Public"
947 layer="canonical.launchpad.layers.TranslationsLayer"947 layer="canonical.launchpad.layers.TranslationsLayer"
948 name="+templates"948 name="+templates"
949 template="../templates/object-templates.pt" />949 template="../templates/object-templates.pt" />
950950
=== modified file 'lib/lp/translations/browser/distroseries.py'
--- lib/lp/translations/browser/distroseries.py 2009-09-17 14:29:22 +0000
+++ lib/lp/translations/browser/distroseries.py 2009-10-22 14:25:21 +0000
@@ -169,9 +169,6 @@
169 potemplateset = getUtility(IPOTemplateSet)169 potemplateset = getUtility(IPOTemplateSet)
170 return potemplateset.getSubset(distroseries=self.context)170 return potemplateset.getSubset(distroseries=self.context)
171171
172 def can_administer(self, template):
173 return check_permission('launchpad.Admin', template)
174
175172
176class DistroSeriesView(LaunchpadView, TranslationsMixin):173class DistroSeriesView(LaunchpadView, TranslationsMixin):
177174
178175
=== modified file 'lib/lp/translations/browser/productseries.py'
--- lib/lp/translations/browser/productseries.py 2009-09-17 12:45:52 +0000
+++ lib/lp/translations/browser/productseries.py 2009-10-22 14:25:21 +0000
@@ -36,7 +36,6 @@
36 LaunchpadView,36 LaunchpadView,
37 Link,37 Link,
38 NavigationMenu)38 NavigationMenu)
39from canonical.launchpad.webapp.authorization import check_permission
40from canonical.launchpad.webapp.menu import structured39from canonical.launchpad.webapp.menu import structured
41from canonical.widgets.itemswidgets import (40from canonical.widgets.itemswidgets import (
42 LaunchpadRadioWidgetWithDescription)41 LaunchpadRadioWidgetWithDescription)
@@ -489,10 +488,6 @@
489 potemplateset = getUtility(IPOTemplateSet)488 potemplateset = getUtility(IPOTemplateSet)
490 return potemplateset.getSubset(productseries=self.context)489 return potemplateset.getSubset(productseries=self.context)
491490
492 def can_administer(self, template):
493 """Can the user administer the template?"""
494 return check_permission('launchpad.Admin', template)
495
496491
497class LinkTranslationsBranchView(LaunchpadEditFormView):492class LinkTranslationsBranchView(LaunchpadEditFormView):
498 """View to set the series' translations export branch."""493 """View to set the series' translations export branch."""
499494
=== modified file 'lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt'
--- lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt 2009-09-14 13:54:29 +0000
+++ lib/lp/translations/stories/distroseries/xx-distroseries-templates.txt 2009-10-22 14:25:21 +0000
@@ -7,24 +7,23 @@
77
8== Getting there ==8== Getting there ==
99
10The view is only visible to the owner of the DistroSeries and administrators.10To get to the listing of all templates, one needs to use the link
11from the distribution series translations page.
1112
12 >>> user_browser.open(13 >>> user_browser.open(
13 ... 'http://translations.launchpad.dev/ubuntu/hoary')14 ... 'http://translations.launchpad.dev/ubuntu/hoary')
14 >>> user_browser.getLink('full list of templates')15 >>> user_browser.getLink('full list of templates').click()
15 Traceback (most recent call last):16 >>> print user_browser.url
16 ...
17 LinkNotFoundError
18
19 >>> admin_browser.open(
20 ... 'http://translations.launchpad.dev/ubuntu/hoary')
21 >>> admin_browser.getLink('full list of templates').click()
22 >>> print admin_browser.url
23 http://translations.launchpad.dev/ubuntu/hoary/+templates17 http://translations.launchpad.dev/ubuntu/hoary/+templates
2418
25
26== The templates table ==19== The templates table ==
2720
21Administrator can see all editing options.
22
23 >>> admin_browser.open(
24 ... 'http://translations.launchpad.dev/ubuntu/hoary')
25 >>> admin_browser.getLink('full list of templates').click()
26
28The page shows a table of all templates and links to their subpages.27The page shows a table of all templates and links to their subpages.
2928
30 >>> table = find_tag_by_id(admin_browser.contents, 'templates_table')29 >>> table = find_tag_by_id(admin_browser.contents, 'templates_table')
3130
=== modified file 'lib/lp/translations/stories/productseries/xx-productseries-templates.txt'
--- lib/lp/translations/stories/productseries/xx-productseries-templates.txt 2009-09-14 19:00:45 +0000
+++ lib/lp/translations/stories/productseries/xx-productseries-templates.txt 2009-10-22 14:25:21 +0000
@@ -7,20 +7,13 @@
77
8== Getting there ==8== Getting there ==
99
10The view is only visible to the owner of the ProductSeries and administrators.10To get to the listing of all templates, one needs to use the link
11from the product series translations page.
1112
12 >>> user_browser.open(13 >>> user_browser.open(
13 ... 'http://translations.launchpad.dev/evolution/trunk')14 ... 'http://translations.launchpad.dev/evolution/trunk')
14 >>> user_browser.getLink('full list of templates')15 >>> user_browser.getLink('full list of templates').click()
15 Traceback (most recent call last):16 >>> print user_browser.url
16 ...
17 LinkNotFoundError
18
19 >>> browser = setupBrowser('Basic test@canonical.com:test')
20 >>> browser.open(
21 ... 'http://translations.launchpad.dev/evolution/trunk')
22 >>> browser.getLink('full list of templates').click()
23 >>> print browser.url
24 http://translations.launchpad.dev/evolution/trunk/+templates17 http://translations.launchpad.dev/evolution/trunk/+templates
2518
2619
@@ -28,11 +21,11 @@
2821
29The page shows a table of all templates and links to their subpages.22The page shows a table of all templates and links to their subpages.
3023
31 >>> table = find_tag_by_id(browser.contents, 'templates_table')24 >>> table = find_tag_by_id(user_browser.contents, 'templates_table')
32 >>> print extract_text(table)25 >>> print extract_text(table)
33 Template name Actions26 Template name Actions
34 evolution-2.2 Edit Upload Download27 evolution-2.2 Download
35 evolution-2.2-test Edit Upload Download28 evolution-2.2-test Download
3629
37If an administrator views this page, links to the templates admin page are30If an administrator views this page, links to the templates admin page are
38shown, too.31shown, too.
3932
=== modified file 'lib/lp/translations/templates/distroseries-translations.pt'
--- lib/lp/translations/templates/distroseries-translations.pt 2009-09-25 16:07:06 +0000
+++ lib/lp/translations/templates/distroseries-translations.pt 2009-10-22 14:25:21 +0000
@@ -49,10 +49,10 @@
49 tal:content="string:${context/displayname} import queue">49 tal:content="string:${context/displayname} import queue">
50 import queue</a>.50 import queue</a>.
51 </p>51 </p>
52 <p tal:condition="context/required:launchpad.Edit">52 <p>
53 To manage all the translation templates in53 To see all the translation templates in
54 <tal:series replace="context/displayname">Hoary</tal:series>,54 <tal:series replace="context/displayname">Hoary</tal:series>,
55 see the55 go to the
56 <a tal:attributes="href context/menu:navigation/templates/url">56 <a tal:attributes="href context/menu:navigation/templates/url">
57 full list of templates</a>.57 full list of templates</a>.
58 </p>58 </p>
5959
=== modified file 'lib/lp/translations/templates/object-templates.pt'
--- lib/lp/translations/templates/object-templates.pt 2009-09-25 16:07:06 +0000
+++ lib/lp/translations/templates/object-templates.pt 2009-10-22 14:25:21 +0000
@@ -75,7 +75,9 @@
75 <th tal:condition="view/is_distroseries"75 <th tal:condition="view/is_distroseries"
76 class="sourcepackage_column">Source package</th>76 class="sourcepackage_column">Source package</th>
77 <th class="template_column">Template name</th>77 <th class="template_column">Template name</th>
78 <th class="actions_column">Actions</th>78 <th class="actions_column"
79 tal:condition="context/required:launchpad.AnyPerson">
80 Actions</th>
79 </tr>81 </tr>
80 </thead>82 </thead>
81 <tbody>83 <tbody>
@@ -86,21 +88,25 @@
86 </td>88 </td>
87 <td class="template_column"><a tal:attributes="href template/fmt:url"89 <td class="template_column"><a tal:attributes="href template/fmt:url"
88 tal:content="template/name">Template name</a></td>90 tal:content="template/name">Template name</a></td>
89 <td class="actions_column">91 <td class="actions_column"
92 tal:condition="context/required:launchpad.AnyPerson">
90 <div class="template_links">93 <div class="template_links">
94 <tal:maintainer condition="template/required:launchpad.Edit">
91 <a tal:attributes="href string:${template/fmt:url}/+edit;95 <a tal:attributes="href string:${template/fmt:url}/+edit;
92 title string:Edit ${template/name}'s details">96 title string:Edit ${template/name}'s details">
93 <img src="/@@/edit" />&nbsp;Edit</a>97 <img src="/@@/edit" />&nbsp;Edit</a>
94 <a tal:attributes="href string:${template/fmt:url}/+upload;98 <a tal:attributes="href string:${template/fmt:url}/+upload;
95 title string:Upload translations to ${template/name}">99 title string:Upload translations to ${template/name}">
96 <img src="/@@/add" />&nbsp;Upload</a>100 <img src="/@@/add" />&nbsp;Upload</a>
97 <a tal:attributes="href string:${template/fmt:url}/+export;101 </tal:maintainer>
98 title string:Download translations from ${template/name}">102 <a tal:attributes="href string:${template/fmt:url}/+export;
99 <img src="/@@/download" />&nbsp;Download</a>103 title string:Download translations from ${template/name}">
100 <a tal:condition="python:view.can_administer(template)"104 <img src="/@@/download" />&nbsp;Download</a>
101 tal:attributes="href string:${template/fmt:url}/+admin;105 <tal:admin condition="template/required:launchpad.Admin">
106 <a tal:attributes="href string:${template/fmt:url}/+admin;
102 title string:Administer ${template/name}">107 title string:Administer ${template/name}">
103 <img src="/@@/edit" />&nbsp;Administer</a>108 <img src="/@@/edit" />&nbsp;Administer</a>
109 </tal:admin>
104 </div>110 </div>
105 </td>111 </td>
106 </tr>112 </tr>
107113
=== modified file 'lib/lp/translations/templates/productseries-translations.pt'
--- lib/lp/translations/templates/productseries-translations.pt 2009-09-25 17:21:00 +0000
+++ lib/lp/translations/templates/productseries-translations.pt 2009-10-22 14:25:21 +0000
@@ -66,10 +66,10 @@
66 <a tal:attributes="href context/menu:navigation/imports/url">66 <a tal:attributes="href context/menu:navigation/imports/url">
67 import queue</a>.67 import queue</a>.
68 </p>68 </p>
69 <p tal:condition="context/required:launchpad.Edit">69 <p>
70 To manage all the translation templates in70 To see all the translation templates in
71 <tal:series replace="context/displayname">trunk</tal:series>,71 <tal:series replace="context/displayname">trunk</tal:series>,
72 see the72 go to the
73 <a tal:attributes="href context/menu:navigation/templates/url">73 <a tal:attributes="href context/menu:navigation/templates/url">
74 full list of templates</a>.74 full list of templates</a>.
75 </p>75 </p>