Merge lp:~ursinha/launchpad/add-translation-focus into lp:launchpad/db-devel

Proposed by Ursula Junque
Status: Rejected
Rejected by: Ursula Junque
Proposed branch: lp:~ursinha/launchpad/add-translation-focus
Merge into: lp:launchpad/db-devel
Diff against target: 92 lines (+21/-3)
5 files modified
lib/lp/registry/configure.zcml (+2/-1)
lib/lp/registry/interfaces/product.py (+8/-0)
lib/lp/registry/model/product.py (+7/-1)
lib/lp/registry/stories/webservice/xx-project-registry.txt (+2/-0)
lib/lp/translations/browser/product.py (+2/-1)
To merge this branch: bzr merge lp:~ursinha/launchpad/add-translation-focus
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Needs Fixing
Review via email: mp+15520@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ursula Junque (ursinha) wrote :
Download full text (3.6 KiB)

= Summary =

This branch fixes bug 422056, adding a way to set translation focus of a product, as we can do with distributions.

== Proposed fix ==

Adding a field with all series of a project on its +changetranslators page.

== Implementation details ==

The implementation is simple: I've added the translation_focus field in product model and interface, and changed the primary_translatable to choose translation_focus if available (and translatable).

== Tests ==

./bin/test -vvt lp.translations.*
./bin/test -vvt lp.registry.*

== Demo and Q/A ==

Preparing:
 1) Go to a project page, such as https://launchpad.dev/alsa-utils
 2) Add another series to the project

A) Choosing non-translatable series as translation focus:
 1) Go to the translations page of the project, https://translations.launchpad.dev/alsa-utils
 2) As an admin user, you'll see the Change permissions option, choose it: https://translations.launchpad.dev/alsa-utils/+changetranslators
 3) Choose the series you just added, and save it
    Result: You should notice the message in the project translations page saying "Launchpad currently recommends translating alsa-utils trunk series", which means that it chose the development focus series because the one chosen as translation focus isn't translatable.

B) Choosing translatable series as translation focus:
 1) Add information to the series you added so it becomes translatable
    Result: You should notice the message in the project translations page saying "Launchpad currently recommends translating <the series you added>", which means that it chose the translation focus now that it's a translatable series.

C) Choosing no translation focus at all:
 1) Choose no series as translation focus
    Result: You should notice that it will recommend to translate the development focus.

= 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/registry/configure.zcml
  lib/lp/registry/interfaces/product.py
  lib/lp/registry/stories/webservice/xx-project-registry.txt
  lib/lp/translations/browser/product.py
  lib/lp/registry/model/product.py

== Pylint notices ==

lib/lp/registry/interfaces/product.py
    593: [C0301] Line too long (83/78)
    34: [F0401] Unable to import 'lazr.enum' (No module named enum)
    72: [F0401] Unable to import 'lazr.restful.fields' (No module named restful)
    73: [F0401] Unable to import 'lazr.restful.interface' (No module named restful)
    74: [F0401] Unable to import 'lazr.restful.declarations' (No module named restful)
    778: [C0322, IProductSet.createProduct] Operator not preceded by a space
    freshmeatproject='freshmeat_project', wikiurl='wiki_url',
    ^
    downloadurl='download_url',
    sourceforgeproject='sourceforge_project',
    programminglang='programming_lang')
    @export_factory_operation(
    IProduct, ['name', 'displayname', 'title', 'summary', 'description',
    'project', 'homepageurl', 'screenshotsurl',
    'downloadurl', 'freshmeatproject', 'wikiurl',
    'sourceforgeproject', 'programminglang',
    'license_reviewed', 'licenses', 'license_info',
    'registra...

Read more...

Revision history for this message
Brad Crittenden (bac) wrote :

Hi Ursula,

Thanks for this patch.

As we discussed on IRC, the tests beginning at line 53 need to have the "if product_series" factored out so it isn't repeated and the other simpler tests nested. Easy fix that will enhance the readability.

Also this change will need some tests. Likely you'll need a doc test, a story, and a web services test to show the value can be changed. As you know we don't have automated tests for access via launchpadlib but doing an interactive session to get and set it will give us confidence it works.

review: Needs Fixing (code)
Revision history for this message
Ursula Junque (ursinha) wrote :

This one has been replaced by https://code.edge.launchpad.net/~ursinha/launchpad/bug422056-add-translation-focus/+merge/17744, keeping this for the sake of history.

Unmerged revisions

8746. By Ursula Junque

added translation_focus_link to the product test, now that it has one :)

8745. By Ursula Junque

last one, I swear

8744. By Ursula Junque

trivial stylistic changes

8743. By Ursula Junque

removed spaces and reidented

8742. By Ursula Junque

now it uses the primary translatable from product.

8741. By Ursula Junque

primary_translatable should only return translation_focus - that already handles if it's not set

8740. By Ursula Junque

Removing unused property

8739. By Ursula Junque

Now translations project page shows the translation_focus in case it's defined, if not it shows the development_focus

8738. By Ursula Junque

Added translation_focus property, changed primary_translatable so it will consider translation_focus first

8737. By Ursula Junque

Return first translation_focus, then development_focus as primary_translatable

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/configure.zcml'
2--- lib/lp/registry/configure.zcml 2009-11-24 21:27:17 +0000
3+++ lib/lp/registry/configure.zcml 2009-12-01 23:10:26 +0000
4@@ -1078,7 +1078,8 @@
5 remote_product screenshotsurl
6 security_contact sourceforgeproject
7 summary title translationgroup
8- translationpermission wikiurl"/>
9+ translationpermission translation_focus
10+ wikiurl"/>
11
12 <!-- mark 2006-04-10 I put "name" in the admin group because
13 with Bazaar now in place, lots of people can have personal
14
15=== modified file 'lib/lp/registry/interfaces/product.py'
16--- lib/lp/registry/interfaces/product.py 2009-11-20 07:32:32 +0000
17+++ lib/lp/registry/interfaces/product.py 2009-12-01 23:10:26 +0000
18@@ -586,6 +586,14 @@
19 readonly=True,
20 value_type=Reference(schema=IProductRelease)))
21
22+ translation_focus = exported(
23+ Choice(
24+ title=_("Translation Focus"),
25+ description=_(
26+ "The ProductSeries that should get the translation effort focus."),
27+ required=False,
28+ vocabulary='FilteredProductSeries'))
29+
30 translatable_packages = Attribute(
31 "A list of the source packages for this product that can be "
32 "translated sorted by distroseries.name and sourcepackage.name.")
33
34=== modified file 'lib/lp/registry/model/product.py'
35--- lib/lp/registry/model/product.py 2009-11-20 07:32:32 +0000
36+++ lib/lp/registry/model/product.py 2009-12-01 23:10:26 +0000
37@@ -230,6 +230,9 @@
38 translationpermission = EnumCol(
39 dbName='translationpermission', notNull=True,
40 schema=TranslationPermission, default=TranslationPermission.OPEN)
41+ translation_focus = ForeignKey(
42+ dbName='translation_focus', foreignKey='ProductSeries',
43+ notNull=False, default=None)
44 bugtracker = ForeignKey(
45 foreignKey="BugTracker", dbName="bugtracker", notNull=False,
46 default=None)
47@@ -746,7 +749,10 @@
48 targetseries = ubuntu.currentseries
49 product_series = self.translatable_series
50
51- # First, go with development focus branch
52+ # First, go with translation focus
53+ if product_series and self.translation_focus in product_series:
54+ return self.translation_focus
55+ # Next, go with development focus
56 if product_series and self.development_focus in product_series:
57 return self.development_focus
58 # Next, go with the latest product series that has templates:
59
60=== modified file 'lib/lp/registry/stories/webservice/xx-project-registry.txt'
61--- lib/lp/registry/stories/webservice/xx-project-registry.txt 2009-11-09 13:01:13 +0000
62+++ lib/lp/registry/stories/webservice/xx-project-registry.txt 2009-12-01 23:10:26 +0000
63@@ -167,6 +167,7 @@
64 sourceforge_project: None
65 summary: u'The Mozilla Firefox web browser'
66 title: u'Mozilla Firefox'
67+ translation_focus_link: None
68 wiki_url: None
69
70 In Launchpad project names may not have uppercase letters in their
71@@ -225,6 +226,7 @@
72 sourceforge_project: None
73 summary: u'The Mozilla Firefox web browser'
74 title: u'Mozilla Firefox'
75+ translation_focus_link: None
76 wiki_url: None
77
78 The milestones can be accessed through the
79
80=== modified file 'lib/lp/translations/browser/product.py'
81--- lib/lp/translations/browser/product.py 2009-10-26 18:40:04 +0000
82+++ lib/lp/translations/browser/product.py 2009-12-01 23:10:26 +0000
83@@ -65,7 +65,8 @@
84 class ProductChangeTranslatorsView(TranslationsMixin, ProductEditView):
85 label = "Set permissions and policies"
86 page_title = "Permissions and policies"
87- field_names = ["translationgroup", "translationpermission"]
88+ field_names = ["translationgroup", "translationpermission",
89+ "translation_focus"]
90
91 @property
92 def cancel_url(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: