~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/adapters/notification.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-02 15:19:38 UTC
  • mfrom: (13144.1.3 notify-announce-list)
  • Revision ID: launchpad@pqm.canonical.com-20110602151938-tawdrs82nnt4fp3q
[r=wgrant][no-qa] Drop announce_list from notify() and
        PackageUpload.acceptFromQueue(), leaving it up to notify() internals.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
 
116
116
 
117
117
def notify(blamer, spr, bprs, customfiles, archive, distroseries, pocket,
118
 
           announce_list=None, summary_text=None, changes=None,
119
 
           changesfile_content=None, changesfile_object=None, action=None,
120
 
           dry_run=False, logger=None):
 
118
           summary_text=None, changes=None, changesfile_content=None,
 
119
           changesfile_object=None, action=None, dry_run=False, logger=None):
121
120
    """Notify about 
122
121
 
123
122
    :param blamer: The `IPerson` who is to blame for this notification.
127
126
    :param archive: The target `IArchive`.
128
127
    :param distroseries: The target `IDistroSeries`.
129
128
    :param pocket: The target `PackagePublishingPocket`.
130
 
    :param announce_list: Where to announce the upload.
131
129
    :param summary_text: The summary of the notification.
132
130
    :param changes: A dictionary of the parsed changes file.
133
131
    :param changesfile_content: The raw content of the changes file, so it
203
201
            spr, bprs, customfiles, archive, distroseries, pocket, action)
204
202
        body = assemble_body(
205
203
            blamer, spr, archive, distroseries, summarystring, changes,
206
 
            action, announce_list)
 
204
            action)
207
205
        send_mail(
208
206
            spr, archive, recipients, subject, body, dry_run,
209
207
            changesfile_content=changesfile_content,
215
213
    # If we're sending an acceptance notification for a non-PPA upload,
216
214
    # announce if possible. Avoid announcing backports, binary-only
217
215
    # security uploads, or autosync uploads.
218
 
    if (action == 'accepted' and announce_list and not archive.is_ppa and
219
 
        pocket != PackagePublishingPocket.BACKPORTS and
220
 
        not (pocket == PackagePublishingPocket.SECURITY and spr is None) and
221
 
        not is_auto_sync_upload(spr, bprs, pocket, changes['Changed-By'])):
 
216
    if (action == 'accepted' and distroseries.changeslist
 
217
        and not archive.is_ppa
 
218
        and pocket != PackagePublishingPocket.BACKPORTS
 
219
        and not (pocket == PackagePublishingPocket.SECURITY and spr is None)
 
220
        and not is_auto_sync_upload(
 
221
            spr, bprs, pocket, changes['Changed-By'])):
222
222
        from_addr = sanitize_string(changes['Changed-By'])
223
223
        name = None
224
224
        bcc_addr = None
230
230
            bcc_addr = '%s_derivatives@packages.qa.debian.org' % name
231
231
 
232
232
        build_and_send_mail(
233
 
            'announcement', [str(announce_list)], from_addr, bcc_addr)
 
233
            'announcement', [str(distroseries.changeslist)], from_addr,
 
234
            bcc_addr)
234
235
 
235
236
 
236
237
def assemble_body(blamer, spr, archive, distroseries, summary, changes,
237
 
                  action, announce_list):
 
238
                  action):
238
239
    """Assemble the e-mail notification body."""
239
240
    information = {
240
241
        'STATUS': ACTION_DESCRIPTIONS[action],
262
263
    if action == 'unapproved':
263
264
        information['SUMMARY'] += (
264
265
            "\nThis upload awaits approval by a distro manager\n")
265
 
    if announce_list:
266
 
        information['ANNOUNCE'] = "Announcing to %s" % announce_list
 
266
    if distroseries.changeslist:
 
267
        information['ANNOUNCE'] = "Announcing to %s" % (
 
268
            distroseries.changeslist)
267
269
    if blamer is not None:
268
270
        signer_signature = '%s <%s>' % (
269
271
            blamer.displayname, blamer.preferredemail.email)