Merge lp:~jcsackett/launchpad/project-involvement-translations-contradiction-652287 into lp:launchpad

Proposed by j.c.sackett
Status: Merged
Merged at revision: 11687
Proposed branch: lp:~jcsackett/launchpad/project-involvement-translations-contradiction-652287
Merge into: lp:launchpad
Diff against target: 88 lines (+38/-0)
4 files modified
lib/lp/registry/browser/pillar.py (+4/-0)
lib/lp/registry/browser/tests/pillar-views.txt (+25/-0)
lib/lp/registry/interfaces/projectgroup.py (+4/-0)
lib/lp/registry/model/projectgroup.py (+5/-0)
To merge this branch: bzr merge lp:~jcsackett/launchpad/project-involvement-translations-contradiction-652287
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code Approve
Review via email: mp+37763@code.launchpad.net

Commit message

Updates the involvement menu for translations on project groups to reflect the status of translatable products within the project.

Description of the change

Summary
=======

Updates the involvement menu for translations on project groups to reflect the
status of translatable products within the project.

Proposed fix
============

Update project groups involvement menu to include the translatable products
conditions.

Pre-implementation notes
========================

Spoke with Curtis about the intent. Spoke with Danilos about what "translatable"
means in this context.

Implementation details
======================

Largely as in proposed; translations_usage on the projectgroup view is
overridden to UNKNOWN in the instance that no products are in the project
group's 'translatables' list.

Tests
=====

bin/test -t pillar-views

Demo and Q/A
============

On launchpad.dev/mozilla/+translations, the "Help translate" menu item is
no longer enabled. If you set up one of the mozilla products for translations,
it will become enabled.

Lint
====

make lint output:

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/browser/pillar.py
  lib/lp/registry/browser/tests/pillar-views.txt
  lib/lp/registry/interfaces/projectgroup.py
  lib/lp/registry/model/projectgroup.py

./lib/lp/registry/model/projectgroup.py
     321: undefined name 'OfficialBugTag'

I'm not sure what's up with the OfficialBugTag issue. It occurs in storm query and isn't part of my branch. I'm happy to fix it, if it's something that needs fixing, but I wasn't sure of what's expected there.

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Hi JC,

This is a nice improvement. I just have a couple of comments below.

-Edwin

>Lint:
> ./lib/lp/registry/model/projectgroup.py
> 321: undefined name 'OfficialBugTag'
>
>I'm not sure what's up with the OfficialBugTag issue. It occurs in storm
>query and isn't part of my branch. I'm happy to fix it, if it's
>something that needs fixing, but I wasn't sure of what's expected there.

That method isn't being used yet due to bug 341203. Please add the
import statement so the lint error goes away.

>=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
>--- lib/lp/registry/interfaces/projectgroup.py 2010-09-22 08:48:24 +0000
>+++ lib/lp/registry/interfaces/projectgroup.py 2010-10-06 18:04:51 +0000
>@@ -320,6 +320,10 @@
> It also should have IProduct.official_rosetta flag set.
> """
>
>+ def has_translatables():
>+ """Return a boolean showing the existance of translatables products.

s/translatables/translatable/

>+ """
>+
> def hasProducts():
> """Returns True if a project has products associated with it, False
> otherwise.
>

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/pillar.py'
2--- lib/lp/registry/browser/pillar.py 2010-09-28 20:57:34 +0000
3+++ lib/lp/registry/browser/pillar.py 2010-10-07 12:26:00 +0000
4@@ -119,6 +119,10 @@
5 # Project groups do not support submit code, override the
6 # default.
7 self.codehosting_usage = ServiceUsage.NOT_APPLICABLE
8+ # Product groups must have translatable products for
9+ # translations_usage to be ServiceUsage.LAUNCHPAD
10+ if not pillar.has_translatable():
11+ self.translations_usage = ServiceUsage.UNKNOWN
12 else:
13 self._set_official_launchpad(pillar)
14 if IDistroSeries.providedBy(self.context):
15
16=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
17--- lib/lp/registry/browser/tests/pillar-views.txt 2010-09-28 20:57:34 +0000
18+++ lib/lp/registry/browser/tests/pillar-views.txt 2010-10-07 12:26:00 +0000
19@@ -200,6 +200,31 @@
20 >>> print view.codehosting_usage.name
21 NOT_APPLICABLE
22
23+Project groups ignore products translations_usage setting if none of the
24+products are fully configured as translatable.
25+
26+ >>> product.translations_usage = ServiceUsage.LAUNCHPAD
27+ >>> project_group.has_translatable()
28+ False
29+
30+ >>> view = create_view(project_group, '+get-involved')
31+ >>> print view.translations_usage.name
32+ UNKNOWN
33+
34+If a product is translatable, translations is enabled in the involvment menu.
35+
36+ >>> series = factory.makeProductSeries(product=product)
37+ >>> pot = factory.makePOTemplateAndPOFiles(
38+ ... productseries=series,
39+ ... language_codes=['es'])
40+ >>> product.translations_usage = ServiceUsage.LAUNCHPAD
41+ >>> project_group.has_translatable()
42+ True
43+
44+ >>> view = create_view(project_group, '+get-involved')
45+ >>> print view.translations_usage.name
46+ LAUNCHPAD
47+
48 DistroSeries can use this view. The distribution is used to set the links.
49
50 >>> series = factory.makeDistroRelease(distribution=distribution)
51
52=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
53--- lib/lp/registry/interfaces/projectgroup.py 2010-09-22 08:48:24 +0000
54+++ lib/lp/registry/interfaces/projectgroup.py 2010-10-07 12:26:00 +0000
55@@ -320,6 +320,10 @@
56 It also should have IProduct.official_rosetta flag set.
57 """
58
59+ def has_translatable():
60+ """Return a boolean showing the existance of translatables products.
61+ """
62+
63 def hasProducts():
64 """Returns True if a project has products associated with it, False
65 otherwise.
66
67=== modified file 'lib/lp/registry/model/projectgroup.py'
68--- lib/lp/registry/model/projectgroup.py 2010-09-22 20:56:52 +0000
69+++ lib/lp/registry/model/projectgroup.py 2010-10-07 12:26:00 +0000
70@@ -74,6 +74,7 @@
71 from lp.bugs.model.bugtarget import (
72 BugTargetBase,
73 HasBugHeatMixin,
74+ OfficialBugTag,
75 )
76 from lp.bugs.model.bugtask import BugTask
77 from lp.code.model.branchvisibilitypolicy import BranchVisibilityPolicyMixin
78@@ -216,6 +217,10 @@
79 clauseTables=['ProductSeries', 'POTemplate'],
80 distinct=True)
81
82+ def has_translatable(self):
83+ """See `IProjectGroup`."""
84+ return self.translatables().count() != 0
85+
86 def _getBaseQueryAndClauseTablesForQueryingSprints(self):
87 query = """
88 Product.project = %s