launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29457
[Merge] ~cjwatson/launchpad:fix-project-series-expensive-exports into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-project-series-expensive-exports into launchpad:master.
Commit message:
Fix xx-product-translations doctest
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/433928
Logged-in users with no special privileges can now neither download nor upload translations for the whole series (though they may be able to do so for individual templates, etc.). Adjust the template a little to avoid producing a nonsensical "You can also translations for {target.name}" sentence, and fix the doctest to match.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-project-series-expensive-exports into launchpad:master.
diff --git a/lib/lp/translations/stories/standalone/xx-product-translations.rst b/lib/lp/translations/stories/standalone/xx-product-translations.rst
index ff6eb21..a11c469 100644
--- a/lib/lp/translations/stories/standalone/xx-product-translations.rst
+++ b/lib/lp/translations/stories/standalone/xx-product-translations.rst
@@ -199,11 +199,32 @@ That's all an anonymous user will see.
>>> print(find_translation_recommendation(anon_browser))
Launchpad currently recommends translating Evolution trunk series.
-A logged-in user is also invited to download translations.
+A logged-in user with no special privileges can neither download
+translations for the whole series (since that's expensive) nor upload them.
>>> user_browser.open(product_url)
>>> print(find_translation_recommendation(user_browser))
Launchpad currently recommends translating Evolution trunk series.
+
+An owner of a related translation group can download translations, but they
+can't upload to the whole series.
+
+ >>> from zope.component import getUtility
+
+ >>> from lp.registry.interfaces.product import IProductSet
+ >>> from lp.testing.pages import setupBrowserForUser
+
+ >>> login("foo.bar@xxxxxxxxxxxxx")
+ >>> group_owner = factory.makePerson()
+ >>> translators = factory.makeTeam(group_owner)
+ >>> group = factory.makeTranslationGroup(translators)
+ >>> evolution = getUtility(IProductSet).getByName("evolution")
+ >>> evolution.translationgroup = group
+ >>> logout()
+ >>> group_owner_browser = setupBrowserForUser(group_owner)
+ >>> group_owner_browser.open(product_url)
+ >>> print(find_translation_recommendation(group_owner_browser))
+ Launchpad currently recommends translating Evolution trunk series.
You can also download translations for trunk.
A user with upload rights sees the invitation not just to download but
@@ -219,8 +240,6 @@ A series is not translatable if all templates are disabled. We need to jump
through some hoops to create that situation.
>>> login("foo.bar@xxxxxxxxxxxxx")
- >>> from zope.component import getUtility
- >>> from lp.registry.interfaces.product import IProductSet
>>> evotrunk = (
... getUtility(IProductSet).getByName("evolution").getSeries("trunk")
... )
diff --git a/lib/lp/translations/templates/product-translations.pt b/lib/lp/translations/templates/product-translations.pt
index ad79952..0e3c06e 100644
--- a/lib/lp/translations/templates/product-translations.pt
+++ b/lib/lp/translations/templates/product-translations.pt
@@ -57,7 +57,7 @@
Launchpad currently recommends translating
<tal:target replace="structure target/fmt:link"
>trunk</tal:target>.
- <span tal:condition="context/required:launchpad.AnyPerson">
+ <span tal:condition="python: path('target/required:launchpad.ExpensiveRequest') or admin_user">
You can also
<tal:expensive condition="target/required:launchpad.ExpensiveRequest">
<a tal:attributes="href target/fmt:url:translations/+export"