Merge lp:~jtv/launchpad/bug-448019 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Eleanor Berger
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~jtv/launchpad/bug-448019
Merge into: lp:launchpad
Diff against target: 52 lines
2 files modified
lib/lp/translations/doc/potemplate.txt (+10/-7)
lib/lp/translations/model/potemplate.py (+5/-3)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-448019
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code Approve
Review via email: mp+13171@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 448019 =

See the bug report for what the problem is, what it costs us, and how I
fixed it. I hope it will also take a lot of wind out of the sails of
bug 447754. This is pretty much a 5-minute fix that'll save us some
real operational time, even if it's not perfect.

In a nutshell, when a translations import approval hits a conflict, this
branch logs not just the translation domain that multiple templates lay
a claim to, as we do now; but also the display names of those templates.
For Ubuntu packages that will include the Ubuntu release series, source
package name, and template name (which is a slightly different thing
from its domain).

== Tests ==

{{{
./bin/test -vv -t potemplate.txt
}}}

Since the logging already happened, and was already tested, I can just
update an existing test. That test is actually for products rather than
packages, so not a great illustration of the real-world problem we see
happening. This is not the place to second-guess POTemplate.displayname
though.

== Demo and Q/A ==

Q/A is annoyingly hard to set up. Only Soyuz does uploads without
specifying a source package name. Luckily we just added a script to
re-upload a package's translations, and there's an obscure case in the
approver that we can use to tickle the problem.

On staging (seriously kids, don't try this on production) do the
following:
 * Pick some arbitrary template in Intrepid, and on its +admin page,
   set its translation domain to "k3b". There are now two templates in
   separate Intrepid source packages with that domain.
 * Run scripts/rosetta/reupload-translations.py -s intrepid -p k3b-i18n
   to re-upload the latest translations tarball for this package.
 * Run cronscripts/rosetta-approve-imports.py -vvv

That last script run will try to approve queue entries for k3b-i18n. A
special case in the approver says that uploads for this package are to
be redirected to other packages, based on template domain matching. The
attempt to do this will run into the clash between the two k3b templates
and log a more helpful message than before.

No lint. Thank you for reviewing!

Jeroen

Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/translations/doc/potemplate.txt'
--- lib/lp/translations/doc/potemplate.txt 2009-07-23 17:49:31 +0000
+++ lib/lp/translations/doc/potemplate.txt 2009-10-10 18:50:26 +0000
@@ -135,18 +135,21 @@
135as an extra parameter. The default value is "None" which disables the filter135as an extra parameter. The default value is "None" which disables the filter
136and both current and disabled templates are returned.136and both current and disabled templates are returned.
137137
138For getPOTemplateByTranslationDomain, this case is an error because only one138For getPOTemplateByTranslationDomain, this case is an error. The
139template per translation domain is allowed.139approver needs a unique domain to identify the right template to upload
140to.
140141
141 >>> potemplatesubset = potemplate_set.getSubset(142 >>> potemplatesubset = potemplate_set.getSubset(
142 ... productseries=productseries)143 ... productseries=productseries)
143 >>> potemplate = potemplatesubset.getPOTemplateByTranslationDomain(144 >>> potemplate = potemplatesubset.getPOTemplateByTranslationDomain(
144 ... 'foodomain')145 ... 'foodomain')
145 WARNING:lp.translations.model.potemplate:Found...146 WARNING:lp.translations.model.potemplate:Found 2 competing templates
146 multiple templates with translation domain 'foodomain'...147 with translation domain 'foodomain':
147 There should be only one.148 "current-template in Fooproduct fooseries";
148 >>> potemplate is None149 "disabled-template in Fooproduct fooseries".
149 True150
151 >>> print potemplate
152 None
150153
151Setting the filter to "True" will only return current (enabled) templates.154Setting the filter to "True" will only return current (enabled) templates.
152155
153156
=== modified file 'lib/lp/translations/model/potemplate.py'
--- lib/lp/translations/model/potemplate.py 2009-09-24 09:10:43 +0000
+++ lib/lp/translations/model/potemplate.py 2009-10-10 18:50:26 +0000
@@ -1106,10 +1106,12 @@
1106 elif len(result) == 1:1106 elif len(result) == 1:
1107 return result[0]1107 return result[0]
1108 else:1108 else:
1109 templates = ['"%s"' % template.displayname for template in result]
1110 templates.sort()
1109 log.warn(1111 log.warn(
1110 "Found multiple templates with translation domain '%s'. "1112 "Found %d competing templates with translation domain '%s': "
1111 "There should be only one."1113 "%s."
1112 % translation_domain)1114 % (len(templates), translation_domain, '; '.join(templates)))
1113 return None1115 return None
11141116
1115 def getPOTemplateByPath(self, path):1117 def getPOTemplateByPath(self, path):