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

Proposed by William Grant
Status: Merged
Merged at revision: 17168
Proposed branch: lp:~wgrant/launchpad/stop-targeted-to-ubuntu
Merge into: lp:launchpad
Diff against target: 117 lines (+19/-33)
4 files modified
lib/lp/translations/browser/tests/translationimportqueue-views.txt (+3/-4)
lib/lp/translations/browser/translationimportqueue.py (+16/-20)
lib/lp/translations/interfaces/translationimportqueue.py (+0/-3)
lib/lp/translations/model/translationimportqueue.py (+0/-6)
To merge this branch: bzr merge lp:~wgrant/launchpad/stop-targeted-to-ubuntu
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+231532@code.launchpad.net

Commit message

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

Description of the change

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.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
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/translations/browser/tests/translationimportqueue-views.txt'
2--- lib/lp/translations/browser/tests/translationimportqueue-views.txt 2014-02-19 04:01:46 +0000
3+++ lib/lp/translations/browser/tests/translationimportqueue-views.txt 2014-08-20 10:09:55 +0000
4@@ -191,13 +191,12 @@
5 >>> ubuntu_view.initial_values['languagepack'] == False
6 True
7
8-For non-Ubuntu distroseries, languagepack is not displayed.
9+For a product template, languagepack is not displayed.
10
11- >>> other_series = factory.makeDistroSeries()
12+ >>> other_series = factory.makeProductSeries()
13 >>> other_entry = queue.addOrUpdateEntry(
14 ... 'demo.pot', '# foo', True,
15- ... importer, distroseries=other_series,
16- ... sourcepackagename=packagename)
17+ ... importer, productseries=other_series)
18 >>> other_view = create_initialized_view(other_entry, '+index')
19 >>> 'languagepack' in other_view.field_names
20 False
21
22=== modified file 'lib/lp/translations/browser/translationimportqueue.py'
23--- lib/lp/translations/browser/translationimportqueue.py 2013-04-10 07:45:16 +0000
24+++ lib/lp/translations/browser/translationimportqueue.py 2014-08-20 10:09:55 +0000
25@@ -115,10 +115,9 @@
26
27 if self.context.sourcepackagename is not None:
28 field_values['sourcepackagename'] = self.context.sourcepackagename
29- if self.context.is_targeted_to_ubuntu:
30 if self.context.potemplate is None:
31- # Default for Ubuntu templates is to
32- # include them in languagepacks.
33+ # Default for distro templates is to include them in
34+ # languagepacks.
35 field_values['languagepack'] = True
36 else:
37 field_values['languagepack'] = (
38@@ -273,15 +272,12 @@
39 'name', 'translation_domain', 'languagepack',
40 'language']
41
42- if self.context.productseries is not None:
43- # We are handling an entry for a productseries, this field is not
44- # useful here.
45+ if self.context.sourcepackagename is None:
46+ # We are handling an entry for a productseries, so these
47+ # fields are not useful here.
48+ self.field_names.remove('languagepack')
49 self.field_names.remove('sourcepackagename')
50
51- if not self.context.is_targeted_to_ubuntu:
52- # Only show languagepack for Ubuntu packages.
53- self.field_names.remove('languagepack')
54-
55 # Execute default initialization.
56 LaunchpadFormView.initialize(self)
57
58@@ -461,18 +457,18 @@
59 self.context.path,
60 self.context.importer)
61
62- if (self.context.sourcepackagename is not None and
63- potemplate.sourcepackagename is not None and
64- self.context.sourcepackagename != potemplate.sourcepackagename):
65- # We got the template from a different package than the one
66- # selected by the user where the import should done, so we
67- # note it here.
68- potemplate.from_sourcepackagename = (
69- self.context.sourcepackagename)
70-
71- if self.context.is_targeted_to_ubuntu:
72+ if self.context.sourcepackagename is not None:
73 potemplate.languagepack = languagepack
74
75+ if (potemplate.sourcepackagename is not None and
76+ self.context.sourcepackagename !=
77+ potemplate.sourcepackagename):
78+ # We got the template from a different package than the one
79+ # selected by the user where the import should done, so we
80+ # note it here.
81+ potemplate.from_sourcepackagename = (
82+ self.context.sourcepackagename)
83+
84 return potemplate
85
86 def _changeActionPO(self, data):
87
88=== modified file 'lib/lp/translations/interfaces/translationimportqueue.py'
89--- lib/lp/translations/interfaces/translationimportqueue.py 2013-01-07 02:40:55 +0000
90+++ lib/lp/translations/interfaces/translationimportqueue.py 2014-08-20 10:09:55 +0000
91@@ -207,9 +207,6 @@
92 title=_("The timestamp when the status was changed."),
93 required=True))
94
95- is_targeted_to_ubuntu = Attribute(
96- "True if this entry is to be imported into the Ubuntu distribution.")
97-
98 sourcepackage = exported(
99 Reference(
100 schema=ISourcePackage,
101
102=== modified file 'lib/lp/translations/model/translationimportqueue.py'
103--- lib/lp/translations/model/translationimportqueue.py 2013-06-20 05:50:00 +0000
104+++ lib/lp/translations/model/translationimportqueue.py 2014-08-20 10:09:55 +0000
105@@ -202,12 +202,6 @@
106 error_output = StringCol(notNull=False, default=None)
107
108 @property
109- def is_targeted_to_ubuntu(self):
110- return (self.distroseries is not None and
111- self.distroseries.distribution ==
112- getUtility(ILaunchpadCelebrities).ubuntu)
113-
114- @property
115 def sourcepackage(self):
116 """See ITranslationImportQueueEntry."""
117 from lp.registry.model.sourcepackage import SourcePackage