← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~ursinha/launchpad/qa-bad-bug-1201485-rebased into lp:launchpad

 

Ursula Junque has proposed merging lp:~ursinha/launchpad/qa-bad-bug-1201485-rebased into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1201485 in Launchpad itself: "Need to import translations for the unity daily builds"
  https://bugs.launchpad.net/launchpad/+bug/1201485

For more details, see:
https://code.launchpad.net/~ursinha/launchpad/qa-bad-bug-1201485-rebased/+merge/192460

Fixing the translations' uploads attribution to the right people: findPersonToNotify or the latest spph creator, falling back to rosetta-admins in case others are None.
-- 
https://code.launchpad.net/~ursinha/launchpad/qa-bad-bug-1201485-rebased/+merge/192460
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~ursinha/launchpad/qa-bad-bug-1201485-rebased into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/rosetta_translations.py'
--- lib/lp/archivepublisher/rosetta_translations.py	2013-10-22 01:46:03 +0000
+++ lib/lp/archivepublisher/rosetta_translations.py	2013-10-24 05:14:20 +0000
@@ -77,9 +77,10 @@
             # packages in main.
             return
 
-        blamee = packageupload.findPersonToNotify()
-        if blamee is None:
-            blamee = getUtility(ILaunchpadCelebrities).rosetta_experts
+        blamee = (packageupload.findPersonToNotify() or
+                  latest_publication.creator or
+                  getUtility(ILaunchpadCelebrities).rosetta_experts)
+
         getUtility(IPackageTranslationsUploadJobSource).create(
             distroseries, libraryfilealias, spr.sourcepackagename, blamee)
 

=== modified file 'lib/lp/soyuz/doc/distroseriesqueue-translations.txt'
--- lib/lp/soyuz/doc/distroseriesqueue-translations.txt	2013-10-10 18:37:49 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue-translations.txt	2013-10-24 05:14:20 +0000
@@ -159,13 +159,16 @@
     >>> queue_item = dapper.getPackageUploads(
     ...     status=PackageUploadStatus.NEW)[0]
 
+    >>> spph_creator = factory.makePerson(name="john-doe")
+
 The source package needs to be published because rosetta translations
 publisher will query for the latest publication to know the destination
 component.
 
     >>> spph = factory.makeSourcePackagePublishingHistory(
     ...     sourcepackagerelease=queue_item.sourcepackagerelease,
-    ...     distroseries=queue_item.distroseries, pocket=queue_item.pocket)
+    ...     distroseries=queue_item.distroseries, pocket=queue_item.pocket,
+    ...     creator=spph_creator)
     >>> queue_item.customfiles[0].publish()
 
 When publish() runs, it creates a PackageTranslationsUploadJob that will
@@ -177,24 +180,25 @@
 
     >>> runPendingPackageTranslationsUploadJob()
 
-As we can see from the translation import queue content. The importer isn't
-the sourcepackagerelease creator, but the person pointed by
-findPersonToNotify, or rosetta-admins.
+As we can see from the translation import queue content, the importer is
+the person pointed by findPersonToNotify, or the latest spph creator,
+or rosetta-admins. In this case, as findPersonToNotify returns nothing,
+the spph creator is the requester.
 
     >>> for entry in translation_import_queue.getAllEntries(target=ubuntu):
     ...     print '%s/%s by %s: %s' % (
     ...         entry.distroseries.name, entry.sourcepackagename.name,
     ...         entry.importer.name, entry.path)
-    dapper/pmount by rosetta-admins: po/es_ES.po
-    dapper/pmount by rosetta-admins: po/ca.po
-    dapper/pmount by rosetta-admins: po/de.po
-    dapper/pmount by rosetta-admins: po/cs.po
-    dapper/pmount by rosetta-admins: po/es.po
-    dapper/pmount by rosetta-admins: po/fr.po
-    dapper/pmount by rosetta-admins: po/hr.po
-    dapper/pmount by rosetta-admins: po/nb.po
-    dapper/pmount by rosetta-admins: po/pmount.pot
-    dapper/pmount by rosetta-admins: po/it_IT.po
+    dapper/pmount by john-doe: po/es_ES.po
+    dapper/pmount by john-doe: po/ca.po
+    dapper/pmount by john-doe: po/de.po
+    dapper/pmount by john-doe: po/cs.po
+    dapper/pmount by john-doe: po/es.po
+    dapper/pmount by john-doe: po/fr.po
+    dapper/pmount by john-doe: po/hr.po
+    dapper/pmount by john-doe: po/nb.po
+    dapper/pmount by john-doe: po/pmount.pot
+    dapper/pmount by john-doe: po/it_IT.po
 
 # Abort the transaction so we can check the same upload in a different
 # pocket.
@@ -238,7 +242,11 @@
     >>> queue_item.customfiles[0].publish()
     >>> runPendingPackageTranslationsUploadJob()
 
-As we can see from the translation import queue content.
+As we can see from the translation import queue content, as the publication
+has no creator specified, it falls back to rosetta-admins as the requester.
+
+    >>> print spph.creator
+    None
 
     >>> for entry in translation_import_queue.getAllEntries(target=ubuntu):
     ...     print '%s/%s by %s: %s' % (

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2013-10-14 01:18:38 +0000
+++ lib/lp/testing/factory.py	2013-10-24 05:14:20 +0000
@@ -3647,6 +3647,7 @@
                                            date_uploaded=UTC_NOW,
                                            scheduleddeletiondate=None,
                                            ancestor=None,
+                                           creator=None,
                                            **kwargs):
         """Make a `SourcePackagePublishingHistory`.
 
@@ -3667,6 +3668,7 @@
         :param scheduleddeletiondate: The date where the publication
             is scheduled to be removed.
         :param ancestor: The publication ancestor parameter.
+        :param creator: The publication creator.
         :param **kwargs: All other parameters are passed through to the
             makeSourcePackageRelease call if needed.
         """
@@ -3703,7 +3705,7 @@
             spph = getUtility(IPublishingSet).newSourcePublication(
                 archive, sourcepackagerelease, distroseries,
                 sourcepackagerelease.component, sourcepackagerelease.section,
-                pocket, ancestor)
+                pocket, ancestor=ancestor, creator=creator)
 
         naked_spph = removeSecurityProxy(spph)
         naked_spph.status = status


Follow ups