~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/team.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-29 11:42:47 UTC
  • mfrom: (13758.2.5 rename-private-team-795771)
  • Revision ID: launchpad@pqm.canonical.com-20110829114247-4dcrebgkji7m3864
[r=sinzui][bug=795771] Allow private teams to be renamed

Show diffs side-by-side

added added

removed removed

Lines of Context:
259
259
        has_mailing_list = (
260
260
            mailing_list is not None and
261
261
            mailing_list.status != MailingListStatus.PURGED)
262
 
        is_private = self.context.visibility == PersonVisibility.PRIVATE
263
262
        has_ppa = self.context.archive is not None
264
263
 
265
 
        block_renaming = (has_mailing_list or is_private or has_ppa)
 
264
        block_renaming = (has_mailing_list or has_ppa)
266
265
        if block_renaming:
267
266
            # This makes the field's widget display (i.e. read) only.
268
267
            self.form_fields['name'].for_display = True
273
272
        # read-only mode if necessary.
274
273
        if block_renaming:
275
274
            # Group the read-only mode reasons in textual form.
276
 
            # Private teams can't be associated with mailing lists
277
 
            # or PPAs yet, so it's a dominant condition.
278
 
            if is_private:
279
 
                reason = 'is private'
280
 
            else:
281
 
                if not has_mailing_list:
282
 
                    reason = 'has a PPA'
283
 
                elif not has_ppa:
284
 
                    reason = 'has a mailing list'
285
 
                else:
286
 
                    reason = 'has a mailing list and a PPA'
 
275
            reasons = []
 
276
            if has_mailing_list:
 
277
                reasons.append('has a mailing list')
 
278
            if has_ppa:
 
279
                reasons.append('has a PPA')
 
280
            reason = ' and '.join(reasons)
287
281
            self.widgets['name'].hint = _(
288
282
                'This team cannot be renamed because it %s.' % reason)
289
283
 
549
543
        already been approved or declined. This can only happen
550
544
        through bypassing the UI.
551
545
        """
552
 
        mailing_list = getUtility(IMailingListSet).get(self.context.name)
 
546
        getUtility(IMailingListSet).get(self.context.name)
553
547
        if self.getListInState(MailingListStatus.REGISTERED) is None:
554
548
            self.addError("This application can't be cancelled.")
555
549
 
985
979
            failed_names = [person.displayname for person in failed_joins]
986
980
            failed_list = ", ".join(failed_names)
987
981
 
988
 
            mapping = dict( this_team=target_team.displayname,
 
982
            mapping = dict(this_team=target_team.displayname,
989
983
                failed_list=failed_list)
990
984
 
991
985
            if len(failed_joins) == 1: