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
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2010-09-28 20:57:34 +0000
+++ lib/lp/registry/browser/pillar.py 2010-10-07 12:26:00 +0000
@@ -119,6 +119,10 @@
119 # Project groups do not support submit code, override the119 # Project groups do not support submit code, override the
120 # default.120 # default.
121 self.codehosting_usage = ServiceUsage.NOT_APPLICABLE121 self.codehosting_usage = ServiceUsage.NOT_APPLICABLE
122 # Product groups must have translatable products for
123 # translations_usage to be ServiceUsage.LAUNCHPAD
124 if not pillar.has_translatable():
125 self.translations_usage = ServiceUsage.UNKNOWN
122 else:126 else:
123 self._set_official_launchpad(pillar)127 self._set_official_launchpad(pillar)
124 if IDistroSeries.providedBy(self.context):128 if IDistroSeries.providedBy(self.context):
125129
=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
--- lib/lp/registry/browser/tests/pillar-views.txt 2010-09-28 20:57:34 +0000
+++ lib/lp/registry/browser/tests/pillar-views.txt 2010-10-07 12:26:00 +0000
@@ -200,6 +200,31 @@
200 >>> print view.codehosting_usage.name200 >>> print view.codehosting_usage.name
201 NOT_APPLICABLE201 NOT_APPLICABLE
202202
203Project groups ignore products translations_usage setting if none of the
204products are fully configured as translatable.
205
206 >>> product.translations_usage = ServiceUsage.LAUNCHPAD
207 >>> project_group.has_translatable()
208 False
209
210 >>> view = create_view(project_group, '+get-involved')
211 >>> print view.translations_usage.name
212 UNKNOWN
213
214If a product is translatable, translations is enabled in the involvment menu.
215
216 >>> series = factory.makeProductSeries(product=product)
217 >>> pot = factory.makePOTemplateAndPOFiles(
218 ... productseries=series,
219 ... language_codes=['es'])
220 >>> product.translations_usage = ServiceUsage.LAUNCHPAD
221 >>> project_group.has_translatable()
222 True
223
224 >>> view = create_view(project_group, '+get-involved')
225 >>> print view.translations_usage.name
226 LAUNCHPAD
227
203DistroSeries can use this view. The distribution is used to set the links.228DistroSeries can use this view. The distribution is used to set the links.
204229
205 >>> series = factory.makeDistroRelease(distribution=distribution)230 >>> series = factory.makeDistroRelease(distribution=distribution)
206231
=== 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-07 12:26:00 +0000
@@ -320,6 +320,10 @@
320 It also should have IProduct.official_rosetta flag set.320 It also should have IProduct.official_rosetta flag set.
321 """321 """
322322
323 def has_translatable():
324 """Return a boolean showing the existance of translatables products.
325 """
326
323 def hasProducts():327 def hasProducts():
324 """Returns True if a project has products associated with it, False328 """Returns True if a project has products associated with it, False
325 otherwise.329 otherwise.
326330
=== modified file 'lib/lp/registry/model/projectgroup.py'
--- lib/lp/registry/model/projectgroup.py 2010-09-22 20:56:52 +0000
+++ lib/lp/registry/model/projectgroup.py 2010-10-07 12:26:00 +0000
@@ -74,6 +74,7 @@
74from lp.bugs.model.bugtarget import (74from lp.bugs.model.bugtarget import (
75 BugTargetBase,75 BugTargetBase,
76 HasBugHeatMixin,76 HasBugHeatMixin,
77 OfficialBugTag,
77 )78 )
78from lp.bugs.model.bugtask import BugTask79from lp.bugs.model.bugtask import BugTask
79from lp.code.model.branchvisibilitypolicy import BranchVisibilityPolicyMixin80from lp.code.model.branchvisibilitypolicy import BranchVisibilityPolicyMixin
@@ -216,6 +217,10 @@
216 clauseTables=['ProductSeries', 'POTemplate'],217 clauseTables=['ProductSeries', 'POTemplate'],
217 distinct=True)218 distinct=True)
218219
220 def has_translatable(self):
221 """See `IProjectGroup`."""
222 return self.translatables().count() != 0
223
219 def _getBaseQueryAndClauseTablesForQueryingSprints(self):224 def _getBaseQueryAndClauseTablesForQueryingSprints(self):
220 query = """225 query = """
221 Product.project = %s226 Product.project = %s