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
1=== modified file 'lib/canonical/launchpad/webapp/tales.py'
2--- lib/canonical/launchpad/webapp/tales.py 2010-01-22 17:31:00 +0000
3+++ lib/canonical/launchpad/webapp/tales.py 2010-01-26 09:55:24 +0000
4@@ -888,6 +888,10 @@
5 """See `BugTaskImageDisplayAPI`"""
6 return self._context.has_specification
7
8+ def _hasPatch(self):
9+ """See `BugTaskImageDisplayAPI`"""
10+ return self._context.has_patch
11+
12
13 class QuestionImageDisplayAPI(ObjectImageDisplayAPI):
14 """Adapter for IQuestion to a formatted string. Used for image:icon."""
15
16=== modified file 'lib/lp/bugs/browser/bugtask.py'
17--- lib/lp/bugs/browser/bugtask.py 2010-01-22 21:04:27 +0000
18+++ lib/lp/bugs/browser/bugtask.py 2010-01-26 09:55:24 +0000
19@@ -1935,12 +1935,13 @@
20 delegates(IBugTask, 'bugtask')
21
22 def __init__(self, bugtask, has_mentoring_offer, has_bug_branch,
23- has_specification, request=None):
24+ has_specification, has_patch, request=None):
25 self.bugtask = bugtask
26 self.review_action_widget = None
27 self.has_mentoring_offer = has_mentoring_offer
28 self.has_bug_branch = has_bug_branch
29 self.has_specification = has_specification
30+ self.has_patch = has_patch
31 self.request = request
32
33 @property
34@@ -1982,6 +1983,7 @@
35 badge_property['has_mentoring_offer'],
36 badge_property['has_branch'],
37 badge_property['has_specification'],
38+ badge_property['has_patch'],
39 request=self.request)
40
41 def getBugListingItems(self):
42
43=== modified file 'lib/lp/bugs/browser/cvereport.py'
44--- lib/lp/bugs/browser/cvereport.py 2009-06-25 00:40:31 +0000
45+++ lib/lp/bugs/browser/cvereport.py 2010-01-26 09:55:24 +0000
46@@ -77,7 +77,8 @@
47 bugtask,
48 has_mentoring_offer=badges['has_mentoring_offer'],
49 has_bug_branch=badges['has_branch'],
50- has_specification=badges['has_specification'])
51+ has_specification=badges['has_specification'],
52+ has_patch=badges['has_patch'])
53 if not bugtaskcves.has_key(bugtask.bug.id):
54 bugtaskcves[bugtask.bug.id] = BugTaskCve()
55 bugtaskcves[bugtask.bug.id].bugtasks.append(bugtask)
56
57=== modified file 'lib/lp/registry/browser/milestone.py'
58--- lib/lp/registry/browser/milestone.py 2010-01-11 14:26:27 +0000
59+++ lib/lp/registry/browser/milestone.py 2010-01-26 09:55:24 +0000
60@@ -244,7 +244,8 @@
61 bugtask,
62 badge_property['has_mentoring_offer'],
63 badge_property['has_branch'],
64- badge_property['has_specification'])
65+ badge_property['has_specification'],
66+ badge_property['has_patch'])
67
68 @cachedproperty
69 def bugtasks(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: