~laney/ubuntu-sponsoring/per-team

« back to all changes in this revision

Viewing changes to sponsors-page.py

  • Committer: Iain Lane
  • Date: 2015-10-09 08:22:42 UTC
  • Revision ID: iain.lane@canonical.com-20151009082242-5hcioci1saz5k64j
Don't think we need to do this recursively actually

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
 
132
132
    def get_uploaders(self):
133
133
        """ Get the set of all people (including teams) who can upload this package. """
134
 
        def add_team_recursively(team):
135
 
            out = set()
136
 
            teams = [p for p in team.participants if p.is_team]
137
 
            for team in teams:
138
 
                out.add(team.name)
139
 
                out |= add_team_recursively(team)
140
 
 
141
 
            return out
142
 
 
143
134
        def permission_to_teams(perms):
144
135
            out = set()
145
136
            for perm in perms:
149
140
                else:
150
141
                    toadd = perm.person
151
142
 
152
 
                out.add(toadd.name)
153
 
                teams_recursive = SponsoringItem._uploader_memo.get(toadd.name,
154
 
                        add_team_recursively(toadd))
155
 
                SponsoringItem._uploader_memo[toadd.name] = teams_recursive
156
 
                out.update(teams_recursive)
 
143
                teams = (SponsoringItem._uploader_memo.get(toadd.name,
 
144
                    [p.name for p in team.participants if p.is_team]) +
 
145
                    [toadd.name])
 
146
                SponsoringItem._uploader_memo[toadd.name] = teams
 
147
                out.update(teams)
157
148
 
158
149
            return out
159
150
 
579
570
    reversed_sponsors = dict(zip(SPONSOR_TEAMS.values(), SPONSOR_TEAMS.keys()))
580
571
 
581
572
    for item in all_sponsoring_items:
 
573
        uploaders = item.get_uploaders() & all_uploaders
582
574
        if options.verbose:
583
 
            uploaders = item.get_uploaders() & all_uploaders
584
575
            print "Uploaders for %s: %s" % (item.package, ", ".join(uploaders))
585
576
        for uploader in uploaders:
586
577
            output_team = reversed_sponsors.get(uploader, uploader)