← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/stop-targeted-to-ubuntu into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/stop-targeted-to-ubuntu into lp:launchpad.

Commit message:
Not only Ubuntu supports langpacks; show POTemplate.languagepack on forms for all distro templates.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1335266 in Launchpad itself: "TranslationImportQueueEntryView only allows assigning templates to language packs for Ubuntu"
  https://bugs.launchpad.net/launchpad/+bug/1335266

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/stop-targeted-to-ubuntu/+merge/231532

Translations code only shows/sets the POTemplate.languagepack field when the template is for Ubuntu. But any distro with translations can potentially use languagepacks, so let's just show it for any distro template.
-- 
https://code.launchpad.net/~wgrant/launchpad/stop-targeted-to-ubuntu/+merge/231532
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/stop-targeted-to-ubuntu into lp:launchpad.
=== modified file 'lib/lp/translations/browser/tests/translationimportqueue-views.txt'
--- lib/lp/translations/browser/tests/translationimportqueue-views.txt	2014-02-19 04:01:46 +0000
+++ lib/lp/translations/browser/tests/translationimportqueue-views.txt	2014-08-20 10:09:55 +0000
@@ -191,13 +191,12 @@
     >>> ubuntu_view.initial_values['languagepack'] == False
     True
 
-For non-Ubuntu distroseries, languagepack is not displayed.
+For a product template, languagepack is not displayed.
 
-    >>> other_series = factory.makeDistroSeries()
+    >>> other_series = factory.makeProductSeries()
     >>> other_entry = queue.addOrUpdateEntry(
     ...     'demo.pot', '# foo', True,
-    ...     importer, distroseries=other_series,
-    ...     sourcepackagename=packagename)
+    ...     importer, productseries=other_series)
     >>> other_view = create_initialized_view(other_entry, '+index')
     >>> 'languagepack' in other_view.field_names
     False

=== modified file 'lib/lp/translations/browser/translationimportqueue.py'
--- lib/lp/translations/browser/translationimportqueue.py	2013-04-10 07:45:16 +0000
+++ lib/lp/translations/browser/translationimportqueue.py	2014-08-20 10:09:55 +0000
@@ -115,10 +115,9 @@
 
         if self.context.sourcepackagename is not None:
             field_values['sourcepackagename'] = self.context.sourcepackagename
-        if self.context.is_targeted_to_ubuntu:
             if self.context.potemplate is None:
-                # Default for Ubuntu templates is to
-                # include them in languagepacks.
+                # Default for distro templates is to include them in
+                # languagepacks.
                 field_values['languagepack'] = True
             else:
                 field_values['languagepack'] = (
@@ -273,15 +272,12 @@
                             'name', 'translation_domain', 'languagepack',
                             'language']
 
-        if self.context.productseries is not None:
-            # We are handling an entry for a productseries, this field is not
-            # useful here.
+        if self.context.sourcepackagename is None:
+            # We are handling an entry for a productseries, so these
+            # fields are not useful here.
+            self.field_names.remove('languagepack')
             self.field_names.remove('sourcepackagename')
 
-        if not self.context.is_targeted_to_ubuntu:
-            # Only show languagepack for Ubuntu packages.
-            self.field_names.remove('languagepack')
-
         # Execute default initialization.
         LaunchpadFormView.initialize(self)
 
@@ -461,18 +457,18 @@
                 self.context.path,
                 self.context.importer)
 
-        if (self.context.sourcepackagename is not None and
-            potemplate.sourcepackagename is not None and
-            self.context.sourcepackagename != potemplate.sourcepackagename):
-            # We got the template from a different package than the one
-            # selected by the user where the import should done, so we
-            # note it here.
-            potemplate.from_sourcepackagename = (
-                self.context.sourcepackagename)
-
-        if self.context.is_targeted_to_ubuntu:
+        if self.context.sourcepackagename is not None:
             potemplate.languagepack = languagepack
 
+            if (potemplate.sourcepackagename is not None and
+                self.context.sourcepackagename !=
+                    potemplate.sourcepackagename):
+                # We got the template from a different package than the one
+                # selected by the user where the import should done, so we
+                # note it here.
+                potemplate.from_sourcepackagename = (
+                    self.context.sourcepackagename)
+
         return potemplate
 
     def _changeActionPO(self, data):

=== modified file 'lib/lp/translations/interfaces/translationimportqueue.py'
--- lib/lp/translations/interfaces/translationimportqueue.py	2013-01-07 02:40:55 +0000
+++ lib/lp/translations/interfaces/translationimportqueue.py	2014-08-20 10:09:55 +0000
@@ -207,9 +207,6 @@
             title=_("The timestamp when the status was changed."),
             required=True))
 
-    is_targeted_to_ubuntu = Attribute(
-        "True if this entry is to be imported into the Ubuntu distribution.")
-
     sourcepackage = exported(
         Reference(
             schema=ISourcePackage,

=== modified file 'lib/lp/translations/model/translationimportqueue.py'
--- lib/lp/translations/model/translationimportqueue.py	2013-06-20 05:50:00 +0000
+++ lib/lp/translations/model/translationimportqueue.py	2014-08-20 10:09:55 +0000
@@ -202,12 +202,6 @@
     error_output = StringCol(notNull=False, default=None)
 
     @property
-    def is_targeted_to_ubuntu(self):
-        return (self.distroseries is not None and
-            self.distroseries.distribution ==
-            getUtility(ILaunchpadCelebrities).ubuntu)
-
-    @property
     def sourcepackage(self):
         """See ITranslationImportQueueEntry."""
         from lp.registry.model.sourcepackage import SourcePackage


Follow ups