Merge lp://staging/~wallyworld/launchpad/improve-personpicker-bugtaskaffiliation-798764 into lp://staging/launchpad
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | 13598 |
Merge reported by: | Curtis Hovey |
Merged at revision: | not available |
Proposed branch: | lp://staging/~wallyworld/launchpad/improve-personpicker-bugtaskaffiliation-798764 |
Merge into: | lp://staging/launchpad |
Diff against target: |
219 lines (+117/-19) 3 files modified
lib/lp/registry/model/pillaraffiliation.py (+24/-2) lib/lp/registry/tests/test_pillaraffiliation.py (+83/-12) lib/lp/testing/factory.py (+10/-5) |
To merge this branch: | bzr merge lp://staging/~wallyworld/launchpad/improve-personpicker-bugtaskaffiliation-798764 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Review via email: mp+70255@code.staging.launchpad.net |
Commit message
Improve the bugtask affiliation adaptor to account for pillar driver, security contact and bug supervisor.
Description of the change
Improve the bugtask affiliation adaptor to account for:
- pillar driver
- pillar security contact
- pillar bug supervisor
The bug mentions adding affiliation checks for blueprints etc - this will be done in another branch and another bug will be created for that.
== Implementation ==
Simply update the getAffiliationB
There are always 4 queries executed to do the core work, being:
select from Bug
select from BugTask
select from Person
select from Product/
The query counts stay the same regardless of whether affiliation checks are done for supervisor, security contact etc. The bug report mentions performance concerns but since the checks for supervisor, security contact do not add to the query count, it's ok to do these checks.
== Tests ==
Update lp/registry/
As well as functional tests, tests are included to check the query counts.
== Lint ==
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
> === modified file 'lib/lp/ registry/ model/pillaraff iliation. py' registry/ model/pillaraff iliation. py 2011-08-03 06:34:41 +0000 registry/ model/pillaraff iliation. py 2011-08-03 06:34:43 +0000 adge(self, person): inTeam( pillar. owner) iver.providedBy (pillar) : tact.providedBy (pillar) : security_ contact or.providedBy( pillar) : bug_supervisor inTeam( pillar. owner) or inTeam( bug_supervisor) or inTeam( security_ contact) or inTeam( driver) )
> --- lib/lp/
> +++ lib/lp/
> @@ -72,7 +75,20 @@
>
> def getAffiliationB
> pillar = self.context.pillar
> - affiliated = person.
> + bug_supervisor = None
> + security_contact = None
> + driver = None
> + if IHasAppointedDr
> + driver = pillar.driver
> + if IHasSecurityCon
> + security_contact = pillar.
> + if IHasBugSupervis
> + bug_supervisor = pillar.
> +
> + affiliated = (person.
> + person.
> + person.
> + person.
Check driver before bug_supervisor. It is a often a larger group and more
important for all Lp applications. bug_supervisor and security_contact are
primarilly about private bugs and security bugs.
> === modified file 'lib/lp/ registry/ tests/test_ pillaraffiliati on.py' registry/ tests/test_ pillaraffiliati on.py 2011-08-03 06:34:41 +0000 registry/ tests/test_ pillaraffiliati on.py 2011-08-03 06:34:43 +0000 arAffiliation( TestCaseWithFac tory): nalLayer distro_ affiliation( self): affiliated_ with_distro( self, person, distro): makeBugTask( target= distro) (bugtask) .getAffiliation Badge(person) ion-badge" , "Affiliated with Pting"))
> --- lib/lp/
> +++ lib/lp/
..
> +class TestBugTaskPill
>
> layer = DatabaseFunctio
>
> - def test_bugtask_
> + def _check_
> + bugtask = self.factory.
> + badge = IHasAffiliation
> + self.assertEqual(
> + badge, ("/@@/distribut
Users wanted to know *how* the user was affilliated. Is the user the
maintainer or the bug_supervisor. This branch does not address this concern.
Were you planning to addess this in a future branch?
Maybe we could change the badge text to state the role? adge() could return the role of the successful test and that
getAffiliationB
is used to make the alt text that will also be shown in the expanded details.
affilliated = None inTeam( pillar. owner):
affilliate d = 'maintainer' inTeam( driver) :
affilliate d = 'driver' inTeam( bug_supervisor) :
affilliate d = 'bug supervisor' inTeam( security_ contact) :
affilliate d = 'security contact'
if person.
elif person.
elif person.
elif person.
if not affiliated: displayname, affiliated)
return None
alt_text = "%s %s" % (pillar.
So the picker would show that both of us as:
Launchpad maintainer