Merge lp:~allenap/launchpad/patch-report-for-people-and-teams-bug-506018 into lp:launchpad

Proposed by Gavin Panella on 2010-02-01
Status: Merged
Approved by: Gavin Panella on 2010-02-03
Approved revision: not available
Merge reported by: Gavin Panella
Merged at revision: not available
Proposed branch: lp:~allenap/launchpad/patch-report-for-people-and-teams-bug-506018
Merge into: lp:launchpad
Prerequisite: lp:~kfogel/launchpad/506018-patch-report
Diff against target: 204 lines (+88/-7)
3 files modified
lib/lp/bugs/browser/bugtarget.py (+8/-3)
lib/lp/bugs/browser/configure.zcml (+7/-0)
lib/lp/bugs/stories/patches-view/patches-view.txt (+73/-4)
To merge this branch: bzr merge lp:~allenap/launchpad/patch-report-for-people-and-teams-bug-506018
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code 2010-02-01 Approve on 2010-02-02
Review via email: mp+18414@code.launchpad.net
To post a comment you must log in.
Gavin Panella (allenap) wrote :

IPerson does not inherit from IHasBugs, so I've registered the BugPatchesView for IPerson too, and added a simple test to show it works.

Eleanor Berger (intellectronica) wrote :

nicely done!

review: Approve (code)
Gavin Panella (allenap) wrote :

Please see r10187, some changes that Abel suggested I add to this branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bugtarget.py'
2--- lib/lp/bugs/browser/bugtarget.py 2010-02-03 17:54:20 +0000
3+++ lib/lp/bugs/browser/bugtarget.py 2010-02-03 17:54:22 +0000
4@@ -70,6 +70,7 @@
5 from lp.registry.interfaces.distributionsourcepackage import (
6 IDistributionSourcePackage)
7 from lp.registry.interfaces.distroseries import IDistroSeries
8+from lp.registry.interfaces.person import IPerson
9 from lp.registry.interfaces.product import IProduct
10 from lp.registry.interfaces.productseries import IProductSeries
11 from lp.registry.interfaces.project import IProject
12@@ -1398,7 +1399,10 @@
13 @property
14 def label(self):
15 """The display label for the view."""
16- return 'Patch attachments in %s' % self.context.displayname
17+ if IPerson.providedBy(self.context):
18+ return 'Patch attachments for %s' % self.context.displayname
19+ else:
20+ return 'Patch attachments in %s' % self.context.displayname
21
22 def batchedPatchTasks(self):
23 """Return a BatchNavigator for bug tasks with patch attachments."""
24@@ -1418,12 +1422,13 @@
25 status=UNRESOLVED_PLUS_FIXRELEASED_BUGTASK_STATUSES,
26 omit_duplicates=True, has_patch=True),
27 self.request)
28-
29+
30 def shouldShowTargetName(self):
31 """Return True if current context can have different bugtargets."""
32 return (IDistribution.providedBy(self.context) or
33 IDistroSeries.providedBy(self.context) or
34- IProject.providedBy(self.context))
35+ IProject.providedBy(self.context) or
36+ IPerson.providedBy(self.context))
37
38 def youngestPatch(self, bug):
39 """Return the youngest patch attached to a bug, else error."""
40
41=== modified file 'lib/lp/bugs/browser/configure.zcml'
42--- lib/lp/bugs/browser/configure.zcml 2010-02-03 17:54:20 +0000
43+++ lib/lp/bugs/browser/configure.zcml 2010-02-03 17:54:23 +0000
44@@ -115,6 +115,13 @@
45 facet="bugs"
46 permission="zope.Public"
47 template="../templates/bugtarget-patches.pt"/>
48+ <browser:page
49+ name="+patches"
50+ for="lp.registry.interfaces.person.IPerson"
51+ class="lp.bugs.browser.bugtarget.BugsPatchesView"
52+ facet="bugs"
53+ permission="zope.Public"
54+ template="../templates/bugtarget-patches.pt"/>
55 </facet>
56 <browser:page
57 name="+bugtarget-macros-search"
58
59=== modified file 'lib/lp/bugs/stories/patches-view/patches-view.txt'
60--- lib/lp/bugs/stories/patches-view/patches-view.txt 2010-02-03 17:54:20 +0000
61+++ lib/lp/bugs/stories/patches-view/patches-view.txt 2010-02-03 17:54:23 +0000
62@@ -9,7 +9,7 @@
63
64 >>> patchy_product = factory.doAsUser(
65 ... 'foo.bar@canonical.com', factory.makeProduct,
66- ... name='patchy-product-1')
67+ ... name='patchy-product-1', displayname="Patchy 1")
68
69 We don't see any patches when we open the patches view.
70
71@@ -76,6 +76,13 @@
72 From: Patchy Person
73 Link: patch_a.diff description of patch a
74
75+The page title and other wording in the page reflects the contents.
76+
77+ >>> print_location(user_browser.contents)
78+ Hierarchy: Patchy 1 > Bugs > Patch attachments in Patchy 1
79+ Tabs: ...
80+ Main heading: Patch attachments in Patchy 1
81+
82 After creating some more bugs, with some non-patch and some patch
83 attachments...
84
85@@ -218,7 +225,7 @@
86 ... 'foo.bar@canonical.com', make_bugtask,
87 ... bug=bug_c, target=patchy_product_series)
88 >>> user_browser.open(
89- ... 'https://launchpad.dev/patchy-product-1/trunk/+patches')
90+ ... 'https://bugs.launchpad.dev/patchy-product-1/trunk/+patches')
91 >>> show_patches_view(user_browser.contents)
92 Bug Importance Status Patch Age
93 Bug #18: bug_c title Wishlist Fix Committed ...second...
94@@ -230,6 +237,13 @@
95 Link: patch_a.diff
96 description of patch a
97
98+The page title and other wording in the page reflects the contents.
99+
100+ >>> print_location(user_browser.contents)
101+ Hierarchy: Patchy 1 > Series trunk > Bugs > Patch attachments in trunk
102+ Tabs: ...
103+ Main heading: Patch attachments in trunk
104+
105 Patches View by Distro
106 ----------------------
107
108@@ -248,6 +262,7 @@
109 ... status=BugTaskStatus.TRIAGED)
110
111 >>> user_browser.open('http://bugs.launchpad.dev/ubuntu/+patches')
112+
113 >>> show_patches_view(user_browser.contents)
114 Bug Importance Status Package Patch Age
115 Bug #18: bug_c title High Triaged a52dec ...second...
116@@ -257,6 +272,11 @@
117 From: Patchy Person
118 Link: patch_a.diff description of patch a
119
120+ >>> print_location(user_browser.contents)
121+ Hierarchy: Ubuntu > Bugs > Patch attachments in Ubuntu
122+ Tabs: ...
123+ Main heading: Patch attachments in Ubuntu
124+
125 Patches View by Distro Series
126 -----------------------------
127
128@@ -276,14 +296,16 @@
129 ... target='warty', target_is_distroseries_name=True,
130 ... importance=BugTaskImportance.HIGH,
131 ... status=BugTaskStatus.TRIAGED)
132- >>> user_browser.open('https://launchpad.dev/ubuntu/hoary/+patches')
133+
134+ >>> user_browser.open('https://bugs.launchpad.dev/ubuntu/hoary/+patches')
135 >>> show_patches_view(user_browser.contents)
136 Bug Importance Status Package Patch Age
137 Bug #16: bug_a title Undecided New hoary ...second...
138 From: Patchy Person
139 Link: patch_a.diff
140 description of patch a
141- >>> user_browser.open('https://launchpad.dev/ubuntu/warty/+patches')
142+
143+ >>> user_browser.open('https://bugs.launchpad.dev/ubuntu/warty/+patches')
144 >>> show_patches_view(user_browser.contents)
145 Bug Importance Status Package Patch Age
146 Bug #18: bug_c title High Triaged warty ...second...
147@@ -298,6 +320,11 @@
148 Link: patch_c.diff
149 description of patch c
150
151+ >>> print_location(user_browser.contents)
152+ Hierarchy: Ubuntu > Warty (4.10) > Bugs > Patch attachments in Warty
153+ Tabs: ...
154+ Main heading: Patch attachments in Warty
155+
156 Patches View by Source Package
157 ------------------------------
158
159@@ -318,3 +345,45 @@
160 Bug #16: bug_a title Medium Fix Released ...second...
161 From: Patchy Person
162 Link: patch_a.diff description of patch a
163+
164+ >>> print_location(user_browser.contents)
165+ Hierarchy: Ubuntu > ?evolution? package > Bugs > Patch ...
166+ Tabs: ...
167+ Main heading: Patch attachments in evolution in ubuntu
168+
169+Patches View by Person and Team
170+-------------------------------
171+
172+The patches view works for people and teams.
173+
174+ >>> user_browser.open(
175+ ... 'http://bugs.launchpad.dev/~%s/+patches' % (
176+ ... patch_submitter.name,))
177+
178+ >>> show_patches_view(user_browser.contents)
179+ Bug Importance Status Package Patch Age
180+ Bug #17: bug_b title Critical Confirmed patchy-product-1 ...second...
181+ From: Patchy Person
182+ Link: patch_c.diff
183+ description of patch c
184+ Bug #18: bug_c title High Triaged a52dec ...second...
185+ From: Patchy Person
186+ Link: patch_f.diff
187+ description of patch f
188+ Bug #18: bug_c title High Triaged warty ...second...
189+ From: Patchy Person
190+ Link: patch_f.diff
191+ description of patch f
192+ Bug #16: bug_a title Medium Fix Released evolution ...second...
193+ From: Patchy Person
194+ Link: patch_a.diff
195+ description of patch a
196+ Bug #18: bug_c title Wishlist Fix Committed patchy-product-1 ...second...
197+ From: Patchy Person
198+ Link: patch_f.diff
199+ description of patch f
200+
201+ >>> print_location(user_browser.contents)
202+ Hierarchy: Patchy Person > Patch attachments for Patchy Person
203+ Tabs: ...
204+ Main heading: Patch attachments for Patchy Person