Merge lp:~salgado/launchpad/cleanup-breadcrumbs into lp:launchpad
- cleanup-breadcrumbs
- Merge into devel
Proposed by
Guilherme Salgado
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~salgado/launchpad/cleanup-breadcrumbs |
Merge into: | lp:launchpad |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~salgado/launchpad/cleanup-breadcrumbs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Celso Providelo (community) | code | Approve | |
Review via email: mp+11133@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote : | # |
Revision history for this message
Celso Providelo (cprov) wrote : | # |
Cool! Very nice change, Salgado.
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/canonical/launchpad/webapp/breadcrumb.py' |
2 | --- lib/canonical/launchpad/webapp/breadcrumb.py 2009-08-31 17:40:56 +0000 |
3 | +++ lib/canonical/launchpad/webapp/breadcrumb.py 2009-09-03 15:04:13 +0000 |
4 | @@ -7,6 +7,8 @@ |
5 | |
6 | __all__ = [ |
7 | 'Breadcrumb', |
8 | + 'DisplaynameBreadcrumb', |
9 | + 'TitleBreadcrumb', |
10 | ] |
11 | |
12 | |
13 | @@ -67,3 +69,19 @@ |
14 | |
15 | return "<%s url='%s' text='%s'%s>" % ( |
16 | self.__class__.__name__, self.url, self.text, icon_repr) |
17 | + |
18 | + |
19 | +class DisplaynameBreadcrumb(Breadcrumb): |
20 | + """An `IBreadcrumb` that uses the context's displayname as its text.""" |
21 | + |
22 | + @property |
23 | + def text(self): |
24 | + return self.context.displayname |
25 | + |
26 | + |
27 | +class TitleBreadcrumb(Breadcrumb): |
28 | + """An `IBreadcrumb` that uses the context's title as its text.""" |
29 | + |
30 | + @property |
31 | + def text(self): |
32 | + return self.context.title |
33 | |
34 | === modified file 'lib/lp/blueprints/browser/sprint.py' |
35 | --- lib/lp/blueprints/browser/sprint.py 2009-08-29 03:38:28 +0000 |
36 | +++ lib/lp/blueprints/browser/sprint.py 2009-09-03 15:04:13 +0000 |
37 | @@ -8,7 +8,6 @@ |
38 | 'SprintAddView', |
39 | 'SprintAttendeesCsvExportView', |
40 | 'SprintBrandingView', |
41 | - 'SprintBreadcrumb', |
42 | 'SprintEditView', |
43 | 'SprintFacets', |
44 | 'SprintMeetingExportView', |
45 | @@ -70,13 +69,6 @@ |
46 | usedfor = ISprint |
47 | |
48 | |
49 | -class SprintBreadcrumb(Breadcrumb): |
50 | - """Builds a breadcrumb for an `ISprint`.""" |
51 | - @property |
52 | - def text(self): |
53 | - return self.context.title |
54 | - |
55 | - |
56 | class SprintOverviewMenu(ApplicationMenu): |
57 | |
58 | usedfor = ISprint |
59 | |
60 | === modified file 'lib/lp/blueprints/configure.zcml' |
61 | --- lib/lp/blueprints/configure.zcml 2009-08-24 20:28:33 +0000 |
62 | +++ lib/lp/blueprints/configure.zcml 2009-09-03 15:04:13 +0000 |
63 | @@ -28,7 +28,7 @@ |
64 | <adapter |
65 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
66 | for="lp.blueprints.interfaces.sprint.ISprint" |
67 | - factory="lp.blueprints.browser.sprint.SprintBreadcrumb" |
68 | + factory="canonical.launchpad.webapp.breadcrumb.TitleBreadcrumb" |
69 | permission="zope.Public"/> |
70 | <adapter |
71 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
72 | |
73 | === modified file 'lib/lp/bugs/browser/bugtracker.py' |
74 | --- lib/lp/bugs/browser/bugtracker.py 2009-08-24 20:28:33 +0000 |
75 | +++ lib/lp/bugs/browser/bugtracker.py 2009-09-03 15:04:13 +0000 |
76 | @@ -7,7 +7,6 @@ |
77 | |
78 | __all__ = [ |
79 | 'BugTrackerAddView', |
80 | - 'BugTrackerBreadcrumb', |
81 | 'BugTrackerContextMenu', |
82 | 'BugTrackerEditView', |
83 | 'BugTrackerNavigation', |
84 | @@ -41,7 +40,6 @@ |
85 | redirection, structured) |
86 | from canonical.launchpad.webapp.authorization import check_permission |
87 | from canonical.launchpad.webapp.batching import BatchNavigator |
88 | -from canonical.launchpad.webapp.breadcrumb import Breadcrumb |
89 | from canonical.widgets import DelimitedListWidget, LaunchpadRadioWidget |
90 | |
91 | |
92 | @@ -194,10 +192,6 @@ |
93 | class BugTrackerEditView(LaunchpadEditFormView): |
94 | |
95 | schema = IBugTracker |
96 | - field_names = ['name', 'title', 'bugtrackertype', |
97 | - 'summary', 'baseurl', 'aliases', 'contactdetails', |
98 | - 'active'] |
99 | - |
100 | custom_widget('summary', TextAreaWidget, width=30, height=5) |
101 | custom_widget('aliases', DelimitedListWidget, height=3) |
102 | custom_widget('active', LaunchpadRadioWidget, orientation='vertical') |
103 | @@ -379,13 +373,6 @@ |
104 | return RemoteBug(self.context, remotebug, bugs) |
105 | |
106 | |
107 | -class BugTrackerBreadcrumb(Breadcrumb): |
108 | - """Builds a breadcrumb for an `IBugTracker`.""" |
109 | - @property |
110 | - def text(self): |
111 | - return self.context.title |
112 | - |
113 | - |
114 | class RemoteBug: |
115 | """Represents a bug in a remote bug tracker.""" |
116 | |
117 | |
118 | === modified file 'lib/lp/bugs/configure.zcml' |
119 | --- lib/lp/bugs/configure.zcml 2009-08-25 13:51:39 +0000 |
120 | +++ lib/lp/bugs/configure.zcml 2009-09-03 15:04:13 +0000 |
121 | @@ -384,7 +384,7 @@ |
122 | <adapter |
123 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
124 | for="lp.bugs.interfaces.bugtracker.IBugTracker" |
125 | - factory="lp.bugs.browser.bugtracker.BugTrackerBreadcrumb" |
126 | + factory="canonical.launchpad.webapp.breadcrumb.TitleBreadcrumb" |
127 | permission="zope.Public"/> |
128 | |
129 | <!-- BugTrackerSet --> |
130 | |
131 | === modified file 'lib/lp/registry/browser/distribution.py' |
132 | --- lib/lp/registry/browser/distribution.py 2009-09-02 05:37:54 +0000 |
133 | +++ lib/lp/registry/browser/distribution.py 2009-09-03 15:04:13 +0000 |
134 | @@ -11,7 +11,6 @@ |
135 | 'DistributionArchiveMirrorsRSSView', |
136 | 'DistributionArchiveMirrorsView', |
137 | 'DistributionArchivesView', |
138 | - 'DistributionBreadcrumb', |
139 | 'DistributionChangeMembersView', |
140 | 'DistributionChangeMirrorAdminView', |
141 | 'DistributionCountryArchiveMirrorsView', |
142 | @@ -172,13 +171,6 @@ |
143 | return self.redirectSubTree(canonical_url(distribution)) |
144 | |
145 | |
146 | -class DistributionBreadcrumb(Breadcrumb): |
147 | - """Builds a breadcrumb for an `IDistribution`.""" |
148 | - @property |
149 | - def text(self): |
150 | - return self.context.displayname |
151 | - |
152 | - |
153 | class DistributionFacets(QuestionTargetFacetMixin, StandardLaunchpadFacets): |
154 | |
155 | usedfor = IDistribution |
156 | |
157 | === modified file 'lib/lp/registry/browser/person.py' |
158 | --- lib/lp/registry/browser/person.py 2009-09-02 13:28:19 +0000 |
159 | +++ lib/lp/registry/browser/person.py 2009-09-03 15:04:13 +0000 |
160 | @@ -22,7 +22,6 @@ |
161 | 'PersonAnswersMenu', |
162 | 'PersonAssignedBugTaskSearchListingView', |
163 | 'PersonBrandingView', |
164 | - 'PersonBreadcrumb', |
165 | 'PersonBugsMenu', |
166 | 'PersonChangePasswordView', |
167 | 'PersonClaimView', |
168 | @@ -662,13 +661,6 @@ |
169 | return Link('+adminteammerge', text, icon='edit') |
170 | |
171 | |
172 | -class PersonBreadcrumb(Breadcrumb): |
173 | - """Builds a breadcrumb for an `IPerson`.""" |
174 | - @property |
175 | - def text(self): |
176 | - return self.context.displayname |
177 | - |
178 | - |
179 | class PersonFacets(StandardLaunchpadFacets): |
180 | """The links that will appear in the facet menu for an IPerson.""" |
181 | |
182 | |
183 | === modified file 'lib/lp/registry/browser/product.py' |
184 | --- lib/lp/registry/browser/product.py 2009-08-31 23:45:03 +0000 |
185 | +++ lib/lp/registry/browser/product.py 2009-09-03 15:04:13 +0000 |
186 | @@ -11,7 +11,6 @@ |
187 | 'ProductAddViewBase', |
188 | 'ProductAdminView', |
189 | 'ProductBrandingView', |
190 | - 'ProductBreadcrumb', |
191 | 'ProductBugsMenu', |
192 | 'ProductDownloadFileMixin', |
193 | 'ProductDownloadFilesView', |
194 | @@ -245,13 +244,6 @@ |
195 | "you soon.")) |
196 | |
197 | |
198 | -class ProductBreadcrumb(Breadcrumb): |
199 | - """Builds a breadcrumb for an `IProduct`.""" |
200 | - @property |
201 | - def text(self): |
202 | - return self.context.displayname |
203 | - |
204 | - |
205 | class ProductFacets(QuestionTargetFacetMixin, StandardLaunchpadFacets): |
206 | """The links that will appear in the facet menu for an IProduct.""" |
207 | |
208 | |
209 | === modified file 'lib/lp/registry/browser/project.py' |
210 | --- lib/lp/registry/browser/project.py 2009-09-01 15:13:46 +0000 |
211 | +++ lib/lp/registry/browser/project.py 2009-09-03 15:04:13 +0000 |
212 | @@ -12,7 +12,6 @@ |
213 | 'ProjectAddView', |
214 | 'ProjectAnswersMenu', |
215 | 'ProjectBrandingView', |
216 | - 'ProjectBreadcrumb', |
217 | 'ProjectBugsMenu', |
218 | 'ProjectEditView', |
219 | 'ProjectFacets', |
220 | @@ -104,13 +103,6 @@ |
221 | return self.redirectSubTree(canonical_url(project)) |
222 | |
223 | |
224 | -class ProjectBreadcrumb(Breadcrumb): |
225 | - """Builds a breadcrumb for an `IProject`.""" |
226 | - @property |
227 | - def text(self): |
228 | - return self.context.displayname |
229 | - |
230 | - |
231 | class ProjectSetBreadcrumb(Breadcrumb): |
232 | """Builds a breadcrumb for an `IProjectSet`.""" |
233 | text = 'Project Groups' |
234 | |
235 | === modified file 'lib/lp/registry/configure.zcml' |
236 | --- lib/lp/registry/configure.zcml 2009-08-28 06:16:06 +0000 |
237 | +++ lib/lp/registry/configure.zcml 2009-09-03 15:04:13 +0000 |
238 | @@ -313,7 +313,7 @@ |
239 | <adapter |
240 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
241 | for="lp.registry.interfaces.project.IProject" |
242 | - factory="lp.registry.browser.project.ProjectBreadcrumb" |
243 | + factory="canonical.launchpad.webapp.breadcrumb.DisplaynameBreadcrumb" |
244 | permission="zope.Public"/> |
245 | <adapter |
246 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
247 | @@ -767,7 +767,7 @@ |
248 | <adapter |
249 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
250 | for="lp.registry.interfaces.person.IPerson" |
251 | - factory="lp.registry.browser.person.PersonBreadcrumb" |
252 | + factory="canonical.launchpad.webapp.breadcrumb.DisplaynameBreadcrumb" |
253 | permission="zope.Public"/> |
254 | <adapter |
255 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
256 | @@ -1186,7 +1186,7 @@ |
257 | <adapter |
258 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
259 | for="lp.registry.interfaces.product.IProduct" |
260 | - factory="lp.registry.browser.product.ProductBreadcrumb" |
261 | + factory="canonical.launchpad.webapp.breadcrumb.DisplaynameBreadcrumb" |
262 | permission="zope.Public"/> |
263 | <adapter |
264 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
265 | @@ -1432,7 +1432,7 @@ |
266 | <adapter |
267 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
268 | for="lp.registry.interfaces.distribution.IDistribution" |
269 | - factory="lp.registry.browser.distribution.DistributionBreadcrumb" |
270 | + factory="canonical.launchpad.webapp.breadcrumb.DisplaynameBreadcrumb" |
271 | permission="zope.Public"/> |
272 | <adapter |
273 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
274 | |
275 | === modified file 'lib/lp/soyuz/browser/archive.py' |
276 | --- lib/lp/soyuz/browser/archive.py 2009-09-01 18:26:21 +0000 |
277 | +++ lib/lp/soyuz/browser/archive.py 2009-09-03 15:04:13 +0000 |
278 | @@ -9,7 +9,6 @@ |
279 | 'ArchiveAdminView', |
280 | 'ArchiveActivateView', |
281 | 'ArchiveBadges', |
282 | - 'ArchiveBreadcrumb', |
283 | 'ArchiveBuildsView', |
284 | 'ArchiveContextMenu', |
285 | 'ArchiveEditDependenciesView', |
286 | @@ -78,7 +77,6 @@ |
287 | from canonical.launchpad.webapp.authorization import check_permission |
288 | from canonical.launchpad.webapp.badge import HasBadgeBase |
289 | from canonical.launchpad.webapp.batching import BatchNavigator |
290 | -from canonical.launchpad.webapp.breadcrumb import Breadcrumb |
291 | from canonical.launchpad.webapp.interfaces import ICanonicalUrlData |
292 | from canonical.launchpad.webapp.menu import structured, NavigationMenu |
293 | from canonical.widgets import ( |
294 | @@ -382,14 +380,6 @@ |
295 | links = [] |
296 | |
297 | |
298 | -class ArchiveBreadcrumb(Breadcrumb): |
299 | - """Builds a breadcrumb for an `IArchive`.""" |
300 | - |
301 | - @property |
302 | - def text(self): |
303 | - return self.context.displayname |
304 | - |
305 | - |
306 | class ArchiveViewBase(LaunchpadView): |
307 | """Common features for Archive view classes.""" |
308 | |
309 | |
310 | === modified file 'lib/lp/soyuz/browser/builder.py' |
311 | --- lib/lp/soyuz/browser/builder.py 2009-08-27 19:22:38 +0000 |
312 | +++ lib/lp/soyuz/browser/builder.py 2009-09-03 15:04:13 +0000 |
313 | @@ -6,7 +6,6 @@ |
314 | __metaclass__ = type |
315 | |
316 | __all__ = [ |
317 | - 'BuilderBreadcrumb', |
318 | 'BuilderFacets', |
319 | 'BuilderOverviewMenu', |
320 | 'BuilderNavigation', |
321 | @@ -74,13 +73,6 @@ |
322 | usedfor = IBuilder |
323 | |
324 | |
325 | -class BuilderBreadcrumb(Breadcrumb): |
326 | - """Builds a breadcrumb for an `IBuilder`.""" |
327 | - @property |
328 | - def text(self): |
329 | - return self.context.title |
330 | - |
331 | - |
332 | class BuilderSetFacets(StandardLaunchpadFacets): |
333 | """The links that will appear in the facet menu for an IBuilderSet.""" |
334 | enable_only = ['overview'] |
335 | |
336 | === modified file 'lib/lp/soyuz/configure.zcml' |
337 | --- lib/lp/soyuz/configure.zcml 2009-09-02 16:30:48 +0000 |
338 | +++ lib/lp/soyuz/configure.zcml 2009-09-03 15:04:13 +0000 |
339 | @@ -416,7 +416,7 @@ |
340 | <adapter |
341 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
342 | for="lp.soyuz.interfaces.archive.IArchive" |
343 | - factory="lp.soyuz.browser.archive.ArchiveBreadcrumb" |
344 | + factory="canonical.launchpad.webapp.breadcrumb.DisplaynameBreadcrumb" |
345 | permission="zope.Public"/> |
346 | |
347 | <!-- ArchiveSet --> |
348 | @@ -522,7 +522,7 @@ |
349 | <adapter |
350 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
351 | for="lp.soyuz.interfaces.builder.IBuilder" |
352 | - factory="lp.soyuz.browser.builder.BuilderBreadcrumb" |
353 | + factory="canonical.launchpad.webapp.breadcrumb.TitleBreadcrumb" |
354 | permission="zope.Public"/> |
355 | <adapter |
356 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
357 | |
358 | === modified file 'lib/lp/translations/browser/translationgroup.py' |
359 | --- lib/lp/translations/browser/translationgroup.py 2009-08-25 16:44:22 +0000 |
360 | +++ lib/lp/translations/browser/translationgroup.py 2009-09-03 15:04:13 +0000 |
361 | @@ -7,7 +7,6 @@ |
362 | __all__ = [ |
363 | 'TranslationGroupAddTranslatorView', |
364 | 'TranslationGroupAddView', |
365 | - 'TranslationGroupBreadcrumb', |
366 | 'TranslationGroupEditView', |
367 | 'TranslationGroupNavigation', |
368 | 'TranslationGroupReassignmentView', |
369 | @@ -46,17 +45,9 @@ |
370 | |
371 | class TranslationGroupSetBreadcrumb(Breadcrumb): |
372 | """Builds a breadcrumb for an `ITranslationGroupSet`.""" |
373 | - |
374 | text = u"Translation groups" |
375 | |
376 | |
377 | -class TranslationGroupBreadcrumb(Breadcrumb): |
378 | - """Builds a breadcrumb for an `ITranslationGroup`.""" |
379 | - |
380 | - @property |
381 | - def text(self): |
382 | - return self.context.title |
383 | - |
384 | class TranslationGroupView: |
385 | |
386 | def __init__(self, context, request): |
387 | |
388 | === modified file 'lib/lp/translations/configure.zcml' |
389 | --- lib/lp/translations/configure.zcml 2009-08-25 16:44:22 +0000 |
390 | +++ lib/lp/translations/configure.zcml 2009-09-03 15:04:13 +0000 |
391 | @@ -397,7 +397,7 @@ |
392 | <adapter |
393 | provides="canonical.launchpad.webapp.interfaces.IBreadcrumb" |
394 | for="lp.translations.interfaces.translationgroup.ITranslationGroup" |
395 | - factory="lp.translations.browser.translationgroup.TranslationGroupBreadcrumb" |
396 | + factory="canonical.launchpad.webapp.breadcrumb.TitleBreadcrumb" |
397 | permission="zope.Public"/> |
398 | |
399 | <!-- TranslationGroupSet --> |
400 |
= Summary =
Most of our IBreadcrumb adapters define just a text property that
returns the context's title or displayname, so I defined some generic
adapters that do just that and used them instead, removing the existing
ones.
The field_names variable removed is because it was redefined a few lines
below. Also, the lint issues on browser/person.py have been fixed on
another branch of mine, so I won't fix them here.
== Tests ==
./bin/test -vvt test_breadcrumbs
== Demo and Q/A ==
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: bugs/configure. zcml registry/ browser/ product. py registry/ configure. zcml /launchpad/ webapp/ breadcrumb. py soyuz/configure .zcml blueprints/ configure. zcml blueprints/ browser/ sprint. py bugs/browser/ bugtracker. py soyuz/browser/ builder. py translations/ configure. zcml translations/ browser/ translationgrou p.py registry/ browser/ person. py registry/ browser/ distribution. py registry/ browser/ project. py soyuz/browser/ archive. py
lib/lp/
lib/lp/
lib/lp/
lib/canonical
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
== Pylint notices ==
lib/lp/ registry/ browser/ product. py
54: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
lib/lp/ soyuz/browser/ builder. py
44: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
lib/lp/ registry/ browser/ person. py interface' (No module named restful)
1186: [C0301] Line too long (79/78)
1273: [C0301] Line too long (79/78)
3120: [W0311] Bad indentation. Found 10 spaces, expected 12
3124: [W0311] Bad indentation. Found 10 spaces, expected 12
119: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
120: [F0401] Unable to import 'lazr.config' (No module named config)
121: [F0401] Unable to import 'lazr.restful.