~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/model/bug.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-29 23:09:37 UTC
  • mfrom: (13814.1.1 bug724025)
  • Revision ID: launchpad@pqm.canonical.com-20110829230937-ugrcoxhl7mfn5zov
[incr] [r=lifeless][bug=724025] Reduce queries when you have several
        branches for a bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1295
1295
            notify(ObjectDeletedEvent(bug_branch, user=user))
1296
1296
            bug_branch.destroySelf()
1297
1297
 
1298
 
    def getVisibleLinkedBranches(self, user):
 
1298
    def getVisibleLinkedBranches(self, user, eager_load=False):
1299
1299
        """Return all the branches linked to the bug that `user` can see."""
1300
1300
        all_branches = getUtility(IAllBranches)
1301
1301
        linked_branches = list(all_branches.visibleByUser(
1302
 
            user).linkedToBugs([self]).getBranches())
 
1302
            user).linkedToBugs([self]).getBranches(eager_load=eager_load))
1303
1303
        if len(linked_branches) == 0:
1304
1304
            return EmptyResultSet()
1305
1305
        else: