Merge lp:~intellectronica/launchpad/patch-badge-performance into lp:launchpad/db-devel

Proposed by Eleanor Berger
Status: Merged
Approved by: Aaron Bentley
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~intellectronica/launchpad/patch-badge-performance
Merge into: lp:launchpad/db-devel
Diff against target: 69 lines (+11/-3)
4 files modified
lib/canonical/launchpad/webapp/tales.py (+4/-0)
lib/lp/bugs/browser/bugtask.py (+3/-1)
lib/lp/bugs/browser/cvereport.py (+2/-1)
lib/lp/registry/browser/milestone.py (+2/-1)
To merge this branch: bzr merge lp:~intellectronica/launchpad/patch-badge-performance
Reviewer Review Type Date Requested Status
Gary Poster (community) release-critical Approve
Aaron Bentley (community) Approve
Review via email: mp+18000@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

This branch optimizes the way we display the patch badge in bug listings by extending the decorator for bugtask listing items to include has_patch.

If the diff looks a bit short it's because:

1. The SQL for getting has_patch has already been added in the original branch (just not used).
2. I have not added any additional tests (since existing tests cover the functionality). I did test manually that the inefficient code path is not being entered when using this version.

Revision history for this message
Aaron Bentley (abentley) :
review: Approve
Revision history for this message
Gary Poster (gary) :
review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/webapp/tales.py'
--- lib/canonical/launchpad/webapp/tales.py 2010-01-22 17:31:00 +0000
+++ lib/canonical/launchpad/webapp/tales.py 2010-01-26 09:55:24 +0000
@@ -888,6 +888,10 @@
888 """See `BugTaskImageDisplayAPI`"""888 """See `BugTaskImageDisplayAPI`"""
889 return self._context.has_specification889 return self._context.has_specification
890890
891 def _hasPatch(self):
892 """See `BugTaskImageDisplayAPI`"""
893 return self._context.has_patch
894
891895
892class QuestionImageDisplayAPI(ObjectImageDisplayAPI):896class QuestionImageDisplayAPI(ObjectImageDisplayAPI):
893 """Adapter for IQuestion to a formatted string. Used for image:icon."""897 """Adapter for IQuestion to a formatted string. Used for image:icon."""
894898
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-01-22 21:04:27 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-01-26 09:55:24 +0000
@@ -1935,12 +1935,13 @@
1935 delegates(IBugTask, 'bugtask')1935 delegates(IBugTask, 'bugtask')
19361936
1937 def __init__(self, bugtask, has_mentoring_offer, has_bug_branch,1937 def __init__(self, bugtask, has_mentoring_offer, has_bug_branch,
1938 has_specification, request=None):1938 has_specification, has_patch, request=None):
1939 self.bugtask = bugtask1939 self.bugtask = bugtask
1940 self.review_action_widget = None1940 self.review_action_widget = None
1941 self.has_mentoring_offer = has_mentoring_offer1941 self.has_mentoring_offer = has_mentoring_offer
1942 self.has_bug_branch = has_bug_branch1942 self.has_bug_branch = has_bug_branch
1943 self.has_specification = has_specification1943 self.has_specification = has_specification
1944 self.has_patch = has_patch
1944 self.request = request1945 self.request = request
19451946
1946 @property1947 @property
@@ -1982,6 +1983,7 @@
1982 badge_property['has_mentoring_offer'],1983 badge_property['has_mentoring_offer'],
1983 badge_property['has_branch'],1984 badge_property['has_branch'],
1984 badge_property['has_specification'],1985 badge_property['has_specification'],
1986 badge_property['has_patch'],
1985 request=self.request)1987 request=self.request)
19861988
1987 def getBugListingItems(self):1989 def getBugListingItems(self):
19881990
=== modified file 'lib/lp/bugs/browser/cvereport.py'
--- lib/lp/bugs/browser/cvereport.py 2009-06-25 00:40:31 +0000
+++ lib/lp/bugs/browser/cvereport.py 2010-01-26 09:55:24 +0000
@@ -77,7 +77,8 @@
77 bugtask,77 bugtask,
78 has_mentoring_offer=badges['has_mentoring_offer'],78 has_mentoring_offer=badges['has_mentoring_offer'],
79 has_bug_branch=badges['has_branch'],79 has_bug_branch=badges['has_branch'],
80 has_specification=badges['has_specification'])80 has_specification=badges['has_specification'],
81 has_patch=badges['has_patch'])
81 if not bugtaskcves.has_key(bugtask.bug.id):82 if not bugtaskcves.has_key(bugtask.bug.id):
82 bugtaskcves[bugtask.bug.id] = BugTaskCve()83 bugtaskcves[bugtask.bug.id] = BugTaskCve()
83 bugtaskcves[bugtask.bug.id].bugtasks.append(bugtask)84 bugtaskcves[bugtask.bug.id].bugtasks.append(bugtask)
8485
=== modified file 'lib/lp/registry/browser/milestone.py'
--- lib/lp/registry/browser/milestone.py 2010-01-11 14:26:27 +0000
+++ lib/lp/registry/browser/milestone.py 2010-01-26 09:55:24 +0000
@@ -244,7 +244,8 @@
244 bugtask,244 bugtask,
245 badge_property['has_mentoring_offer'],245 badge_property['has_mentoring_offer'],
246 badge_property['has_branch'],246 badge_property['has_branch'],
247 badge_property['has_specification'])247 badge_property['has_specification'],
248 badge_property['has_patch'])
248249
249 @cachedproperty250 @cachedproperty
250 def bugtasks(self):251 def bugtasks(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: