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
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2009-11-24 21:27:17 +0000
+++ lib/lp/registry/configure.zcml 2009-12-01 23:10:26 +0000
@@ -1078,7 +1078,8 @@
1078 remote_product screenshotsurl1078 remote_product screenshotsurl
1079 security_contact sourceforgeproject1079 security_contact sourceforgeproject
1080 summary title translationgroup1080 summary title translationgroup
1081 translationpermission wikiurl"/>1081 translationpermission translation_focus
1082 wikiurl"/>
10821083
1083 <!-- mark 2006-04-10 I put "name" in the admin group because1084 <!-- mark 2006-04-10 I put "name" in the admin group because
1084 with Bazaar now in place, lots of people can have personal1085 with Bazaar now in place, lots of people can have personal
10851086
=== modified file 'lib/lp/registry/interfaces/product.py'
--- lib/lp/registry/interfaces/product.py 2009-11-20 07:32:32 +0000
+++ lib/lp/registry/interfaces/product.py 2009-12-01 23:10:26 +0000
@@ -586,6 +586,14 @@
586 readonly=True,586 readonly=True,
587 value_type=Reference(schema=IProductRelease)))587 value_type=Reference(schema=IProductRelease)))
588588
589 translation_focus = exported(
590 Choice(
591 title=_("Translation Focus"),
592 description=_(
593 "The ProductSeries that should get the translation effort focus."),
594 required=False,
595 vocabulary='FilteredProductSeries'))
596
589 translatable_packages = Attribute(597 translatable_packages = Attribute(
590 "A list of the source packages for this product that can be "598 "A list of the source packages for this product that can be "
591 "translated sorted by distroseries.name and sourcepackage.name.")599 "translated sorted by distroseries.name and sourcepackage.name.")
592600
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2009-11-20 07:32:32 +0000
+++ lib/lp/registry/model/product.py 2009-12-01 23:10:26 +0000
@@ -230,6 +230,9 @@
230 translationpermission = EnumCol(230 translationpermission = EnumCol(
231 dbName='translationpermission', notNull=True,231 dbName='translationpermission', notNull=True,
232 schema=TranslationPermission, default=TranslationPermission.OPEN)232 schema=TranslationPermission, default=TranslationPermission.OPEN)
233 translation_focus = ForeignKey(
234 dbName='translation_focus', foreignKey='ProductSeries',
235 notNull=False, default=None)
233 bugtracker = ForeignKey(236 bugtracker = ForeignKey(
234 foreignKey="BugTracker", dbName="bugtracker", notNull=False,237 foreignKey="BugTracker", dbName="bugtracker", notNull=False,
235 default=None)238 default=None)
@@ -746,7 +749,10 @@
746 targetseries = ubuntu.currentseries749 targetseries = ubuntu.currentseries
747 product_series = self.translatable_series750 product_series = self.translatable_series
748751
749 # First, go with development focus branch752 # First, go with translation focus
753 if product_series and self.translation_focus in product_series:
754 return self.translation_focus
755 # Next, go with development focus
750 if product_series and self.development_focus in product_series:756 if product_series and self.development_focus in product_series:
751 return self.development_focus757 return self.development_focus
752 # Next, go with the latest product series that has templates:758 # Next, go with the latest product series that has templates:
753759
=== modified file 'lib/lp/registry/stories/webservice/xx-project-registry.txt'
--- lib/lp/registry/stories/webservice/xx-project-registry.txt 2009-11-09 13:01:13 +0000
+++ lib/lp/registry/stories/webservice/xx-project-registry.txt 2009-12-01 23:10:26 +0000
@@ -167,6 +167,7 @@
167 sourceforge_project: None167 sourceforge_project: None
168 summary: u'The Mozilla Firefox web browser'168 summary: u'The Mozilla Firefox web browser'
169 title: u'Mozilla Firefox'169 title: u'Mozilla Firefox'
170 translation_focus_link: None
170 wiki_url: None171 wiki_url: None
171172
172In Launchpad project names may not have uppercase letters in their173In Launchpad project names may not have uppercase letters in their
@@ -225,6 +226,7 @@
225 sourceforge_project: None226 sourceforge_project: None
226 summary: u'The Mozilla Firefox web browser'227 summary: u'The Mozilla Firefox web browser'
227 title: u'Mozilla Firefox'228 title: u'Mozilla Firefox'
229 translation_focus_link: None
228 wiki_url: None230 wiki_url: None
229231
230The milestones can be accessed through the232The milestones can be accessed through the
231233
=== modified file 'lib/lp/translations/browser/product.py'
--- lib/lp/translations/browser/product.py 2009-10-26 18:40:04 +0000
+++ lib/lp/translations/browser/product.py 2009-12-01 23:10:26 +0000
@@ -65,7 +65,8 @@
65class ProductChangeTranslatorsView(TranslationsMixin, ProductEditView):65class ProductChangeTranslatorsView(TranslationsMixin, ProductEditView):
66 label = "Set permissions and policies"66 label = "Set permissions and policies"
67 page_title = "Permissions and policies"67 page_title = "Permissions and policies"
68 field_names = ["translationgroup", "translationpermission"]68 field_names = ["translationgroup", "translationpermission",
69 "translation_focus"]
6970
70 @property71 @property
71 def cancel_url(self):72 def cancel_url(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: