~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/queue.py

  • Committer: Curtis Hovey
  • Date: 2011-12-29 05:29:36 UTC
  • mto: This revision was merged to the branch mainline in revision 14606.
  • Revision ID: curtis.hovey@canonical.com-20111229052936-c261pibg1p6ze6m4
Moved canonical.config to lp.services.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
from zope.component import getUtility
40
40
from zope.interface import implements
41
41
 
 
42
from lp.services.config import config
 
43
from canonical.database.constants import UTC_NOW
 
44
from canonical.database.datetimecol import UtcDateTimeCol
 
45
from canonical.database.enumcol import EnumCol
 
46
from canonical.database.sqlbase import (
 
47
    SQLBase,
 
48
    sqlvalues,
 
49
    )
 
50
from canonical.librarian.interfaces import DownloadFailed
 
51
from canonical.librarian.utils import copy_and_close
42
52
from lp.app.errors import NotFoundError
43
53
# XXX 2009-05-10 julian
44
54
# This should not import from archivepublisher, but to avoid
49
59
from lp.archiveuploader.tagfiles import parse_tagfile_content
50
60
from lp.registry.interfaces.pocket import PackagePublishingPocket
51
61
from lp.registry.model.sourcepackagename import SourcePackageName
52
 
from lp.services.config import config
53
 
from lp.services.database.constants import UTC_NOW
54
 
from lp.services.database.datetimecol import UtcDateTimeCol
55
 
from lp.services.database.enumcol import EnumCol
56
62
from lp.services.database.lpstorm import (
57
63
    IMasterStore,
58
64
    IStore,
59
65
    )
60
 
from lp.services.database.sqlbase import (
61
 
    SQLBase,
62
 
    sqlvalues,
63
 
    )
64
 
from lp.services.librarian.interfaces.client import DownloadFailed
65
66
from lp.services.librarian.model import LibraryFileAlias
66
 
from lp.services.librarian.utils import copy_and_close
67
67
from lp.services.mail.signedmessage import strip_pgp_signature
68
68
from lp.services.propertycache import cachedproperty
69
69
from lp.soyuz.adapters.notification import notify
845
845
        # and uploading to any archive as the signer.
846
846
        return changes, strip_pgp_signature(changes_content).splitlines(True)
847
847
 
848
 
    def findSourcePublication(self):
849
 
        """Find the `SourcePackagePublishingHistory` for this build."""
850
 
        first_build = self.builds[:1]
851
 
        if first_build:
852
 
            [first_build] = first_build
853
 
            return first_build.build._getLatestPublication()
854
 
        else:
855
 
            return None
856
 
 
857
 
    def findPersonToNotify(self):
858
 
        """Find the right person to notify about this upload."""
859
 
        spph = self.findSourcePublication()
860
 
        if spph and self.sourcepackagerelease.upload_archive != self.archive:
861
 
            # This is a build triggered by the syncing of a source
862
 
            # package.  Notify the person who requested the sync.
863
 
            return spph.creator
864
 
        elif self.signing_key:
865
 
            return self.signing_key.owner
866
 
        else:
867
 
            return None
868
 
 
869
848
    def notify(self, summary_text=None, changes_file_object=None,
870
849
               logger=None, dry_run=False):
871
850
        """See `IPackageUpload`."""
881
860
            changesfile_content = changes_file_object.read()
882
861
        else:
883
862
            changesfile_content = 'No changes file content available.'
884
 
        blamee = self.findPersonToNotify()
 
863
        if self.signing_key is not None:
 
864
            signer = self.signing_key.owner
 
865
        else:
 
866
            signer = None
885
867
        notify(
886
 
            blamee, self.sourcepackagerelease, self.builds, self.customfiles,
 
868
            signer, self.sourcepackagerelease, self.builds, self.customfiles,
887
869
            self.archive, self.distroseries, self.pocket, summary_text,
888
870
            changes, changesfile_content, changes_file_object,
889
871
            status_action[self.status], dry_run=dry_run, logger=logger)