William Grant has proposed merging lp:~wgrant/launchpad/bug-1158854 into 
lp:launchpad.

Commit message:
Fix POFile.getTranslationRows() to do the message sharing filter in the join 
condition, since otherwise we end up excluding POTMsgSets that are only 
translated in another template. Fixes PO exports missing some untranslated 
strings.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1158854 in Launchpad itself: "String present in Launchpad is not 
exported"
  https://bugs.launchpad.net/launchpad/+bug/1158854

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-1158854/+merge/155892

POFile.getTranslationRows was accidentally not returning potmsgsets that were 
untranslated except in a different template. Translated sets were returned, and 
entirely untranslated sets were too, but sets with only a diverged translation 
for another template were missing. This branch fixes the core query in 
POFile._selectRows to do the message sharing filter in the join condition 
rather than in the WHERE clause, so a null row can be returned even if there's 
a non-null row.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-1158854/+merge/155892
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~wgrant/launchpad/bug-1158854 into lp:launchpad.
=== modified file 'lib/lp/translations/doc/vpoexport.txt'
--- lib/lp/translations/doc/vpoexport.txt	2011-02-24 14:31:46 +0000
+++ lib/lp/translations/doc/vpoexport.txt	2013-03-28 05:25:26 +0000
@@ -139,9 +139,11 @@
     >>> for row in trunk_pofile.getTranslationRows():
     ...     print describe_poexport_row(row)
     1   1   een
+    2   2   None
 
 In an export for stable, only the stable message shows up.
 
     >>> for row in stable_pofile.getTranslationRows():
     ...     print describe_poexport_row(row)
     2   2   twee
+    1   1   None

=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py	2013-01-07 02:40:55 +0000
+++ lib/lp/translations/model/pofile.py	2013-03-28 05:25:26 +0000
@@ -1233,13 +1233,17 @@
 
         flag_name = getUtility(ITranslationSideTraitsSet).getForTemplate(
             self.potemplate).flag_name
+        template_id = quote(self.potemplate)
         params = {
             'flag': flag_name,
             'language': quote(self.language),
+            'template': template_id,
         }
         query = main_select + """
             FROM TranslationTemplateItem
             LEFT JOIN TranslationMessage ON
+                (TranslationMessage.potemplate IS NULL
+                 OR TranslationMessage.potemplate = %(template)s) AND
                 TranslationMessage.potmsgset =
                     TranslationTemplateItem.potmsgset AND
                 TranslationMessage.%(flag)s IS TRUE AND
@@ -1252,12 +1256,7 @@
             query += "LEFT JOIN POTranslation AS %s ON %s.id = %s\n" % (
                     alias, alias, field)
 
-        template_id = quote(self.potemplate)
-        conditions = [
-            "TranslationTemplateItem.potemplate = %s" % template_id,
-            "(TranslationMessage.potemplate IS NULL OR "
-                 "TranslationMessage.potemplate = %s)" % template_id,
-            ]
+        conditions = ["TranslationTemplateItem.potemplate = %s" % template_id]
 
         if ignore_obsolete:
             conditions.append("TranslationTemplateItem.sequence <> 0")

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to