Merge lp:~stevenk/launchpad/destroy-getusedbugtags into lp:launchpad

Proposed by Steve Kowalik on 2012-08-03
Status: Merged
Approved by: William Grant on 2012-08-03
Approved revision: no longer in the source branch.
Merged at revision: 15741
Proposed branch: lp:~stevenk/launchpad/destroy-getusedbugtags
Merge into: lp:launchpad
Diff against target: 650 lines (+17/-304)
18 files modified
lib/lp/bugs/browser/bug.py (+5/-61)
lib/lp/bugs/browser/configure.zcml (+1/-1)
lib/lp/bugs/browser/tests/bug-views.txt (+2/-48)
lib/lp/bugs/doc/bug-tags.txt (+6/-51)
lib/lp/bugs/interfaces/bugtarget.py (+0/-3)
lib/lp/bugs/model/bug.py (+0/-16)
lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt (+0/-32)
lib/lp/bugs/stories/bugs/xx-bug-activity.txt (+0/-2)
lib/lp/bugs/stories/bugs/xx-bug-edit.txt (+1/-21)
lib/lp/bugs/templates/bug-edit.pt (+0/-22)
lib/lp/registry/configure.zcml (+0/-1)
lib/lp/registry/model/distribution.py (+1/-9)
lib/lp/registry/model/distributionsourcepackage.py (+0/-4)
lib/lp/registry/model/distroseries.py (+0/-6)
lib/lp/registry/model/product.py (+1/-8)
lib/lp/registry/model/productseries.py (+0/-6)
lib/lp/registry/model/projectgroup.py (+0/-9)
lib/lp/registry/model/sourcepackage.py (+0/-4)
To merge this branch: bzr merge lp:~stevenk/launchpad/destroy-getusedbugtags
Reviewer Review Type Date Requested Status
William Grant code 2012-08-03 Approve on 2012-08-03
Review via email: mp+118024@code.launchpad.net

Commit Message

Destroy IBugTarget.getUsedBugTags() and what it relies on, removing the need to explicitly add tags via BugEditView, slimming that down too.

Description of the Change

Destroy IBugTarget.getUsedBugTags(), get_bug_tags() -- they are only used in one place in BugEditView's validate method to make sure that new bug tags are explicitly created. Except the function is horrid and has at least XSS hole, perhaps more.

Due to the aforementioned death, BugEditView has been reduced to a shadow of its former self, and its template has been deleted so it makes use of the generic-edit template.

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bug.py'
2--- lib/lp/bugs/browser/bug.py 2012-07-31 09:41:51 +0000
3+++ lib/lp/bugs/browser/bug.py 2012-08-03 02:45:24 +0000
4@@ -701,6 +701,8 @@
5 """Return the next URL to call when this call completes."""
6 return canonical_url(self.context)
7
8+ cancel_url = next_url
9+
10
11 class BugEditView(BugEditViewBase):
12 """The view for the edit bug page."""
13@@ -708,71 +710,18 @@
14 field_names = ['title', 'description', 'tags']
15 custom_widget('title', TextWidget, displayWidth=30)
16 custom_widget('tags', BugTagsWidget)
17- next_url = None
18-
19- _confirm_new_tags = False
20-
21- def __init__(self, context, request):
22- """context is always an IBugTask."""
23- BugEditViewBase.__init__(self, context, request)
24- self.notifications = []
25
26 @property
27 def label(self):
28 """The form label."""
29 return 'Edit details for bug #%d' % self.context.bug.id
30
31- @property
32- def page_title(self):
33- """The page title."""
34- return self.label
35-
36- @property
37- def cancel_url(self):
38- """See `LaunchpadFormView`."""
39- return canonical_url(self.context)
40-
41- def validate(self, data):
42- """Make sure new tags are confirmed."""
43- if 'tags' not in data:
44- return
45- confirm_action = self.confirm_tag_action
46- if confirm_action.submitted():
47- # Validation is needed only for the change action.
48- return
49- bugtarget = self.context.target
50- newly_defined_tags = set(data['tags']).difference(
51- bugtarget.getUsedBugTags() + bugtarget.official_bug_tags)
52- # Display the confirm button in a notification message. We want
53- # it to be slightly smaller than usual, so we can't simply let
54- # it render itself.
55- confirm_button = (
56- '<input style="font-size: smaller" type="submit"'
57- ' value="%s" name="%s" />' % (
58- confirm_action.label, confirm_action.__name__))
59- for new_tag in newly_defined_tags:
60- self.notifications.append(
61- 'The tag "%s" hasn\'t been used by %s before. %s' % (
62- new_tag, bugtarget.bugtargetdisplayname, confirm_button))
63- self._confirm_new_tags = True
64+ page_title = label
65
66 @action('Change', name='change')
67- def edit_bug_action(self, action, data):
68+ def change_action(self, action, data):
69 """Update the bug with submitted changes."""
70- if not self._confirm_new_tags:
71- self.updateBugFromData(data)
72- self.next_url = canonical_url(self.context)
73-
74- @action('Create the new tag', name='confirm_tag')
75- def confirm_tag_action(self, action, data):
76- """Define a new tag."""
77- self.actions['field.actions.change'].success(data)
78-
79- def render(self):
80- """Render the page with only one submit button."""
81- # The confirmation button shouldn't be rendered automatically.
82- self.actions = [self.edit_bug_action]
83- return BugEditViewBase.render(self)
84+ self.updateBugFromData(data)
85
86
87 class BugMarkAsDuplicateView(BugEditViewBase):
88@@ -782,11 +731,6 @@
89 label = "Mark bug report as a duplicate"
90 page_title = label
91
92- @property
93- def cancel_url(self):
94- """See `LaunchpadFormView`."""
95- return canonical_url(self.context)
96-
97 def setUpFields(self):
98 """Make the readonly version of duplicateof available."""
99 super(BugMarkAsDuplicateView, self).setUpFields()
100
101=== modified file 'lib/lp/bugs/browser/configure.zcml'
102--- lib/lp/bugs/browser/configure.zcml 2012-08-02 07:02:18 +0000
103+++ lib/lp/bugs/browser/configure.zcml 2012-08-03 02:45:24 +0000
104@@ -525,7 +525,7 @@
105 name="+edit"
106 for="lp.bugs.interfaces.bugtask.IBugTask"
107 class="lp.bugs.browser.bug.BugEditView"
108- template="../templates/bug-edit.pt"
109+ template="../../app/templates/generic-edit.pt"
110 permission="launchpad.Edit"/>
111 <browser:page
112 name="+delete"
113
114=== modified file 'lib/lp/bugs/browser/tests/bug-views.txt'
115--- lib/lp/bugs/browser/tests/bug-views.txt 2012-04-12 22:50:15 +0000
116+++ lib/lp/bugs/browser/tests/bug-views.txt 2012-08-03 02:45:24 +0000
117@@ -633,7 +633,6 @@
118 False
119 >>> bug_edit.wasRedirected()
120 True
121-
122 >>> bug_one.title
123 u'New title'
124 >>> bug_one.description
125@@ -641,7 +640,6 @@
126 >>> bug_one.tags
127 [u'doc']
128
129-
130 Emails are sent out by adding entries to the bugnotification table. We
131 need to know how many messages are currently in that table.
132
133@@ -649,59 +647,15 @@
134 >>> bn_set = BugNotification.select(BugNotification.q.bugID == bug_one.id)
135 >>> start_bugnotification_count = bn_set.count()
136
137-Re-adding the same tag that already exists shouldn't notify anyone.
138-
139- >>> edit_values['field.tags'] = u'doc doc'
140- >>> bug_edit.submit('change', edit_values)
141- >>> bug_edit.hasErrors()
142- False
143- >>> for message in bug_edit.view.notifications:
144- ... print message
145-
146- >>> bug_edit.wasRedirected()
147- True
148- >>> bn_set = BugNotification.select(BugNotification.q.bugID == bug_one.id)
149- >>> bn_set.count() == start_bugnotification_count
150- True
151-
152-The tag 'doc' has already been used for other Firefox bugs, let's try
153-adding a tag that hasn't already been used. Add 'new-tag' multiple times
154-so that we can verify that it will only be added once.
155+Add 'new-tag' multiple times so that we can verify that it will only be added
156+once.
157
158 >>> edit_values['field.tags'] = u'new-tag doc new-tag'
159 >>> bug_edit.submit('change', edit_values)
160-
161-Now the form will have a notification, asking us to confirm that we indeed
162-want to use a new tag. The notification includes a button, with which
163-the user can confirm that he wants to add the tag.
164-
165- >>> bug_edit.hasErrors()
166- False
167- >>> for message in bug_edit.view.notifications:
168- ... print message
169- The tag "new-tag" hasn't been used by Mozilla Firefox before.
170- <input ...Create the new tag...>
171-
172- >>> bug_edit.wasRedirected()
173- False
174-
175-The form still contains the 'Change' button, though, so that the user
176-can edit the tag and submit the form again.
177-
178- >>> bug_edit.view.render()
179- EDIT BUG
180- >>> [action.label for action in bug_edit.view.actions]
181- ['Change']
182-
183-If we click on the 'Create the new tag' button, we'll get redirected to
184-the bug page, and the bug will have the new tag.
185-
186- >>> bug_edit.submit('confirm_tag', edit_values)
187 >>> bug_edit.hasErrors()
188 False
189 >>> bug_edit.wasRedirected()
190 True
191-
192 >>> bug_one.tags
193 [u'doc', u'new-tag']
194
195
196=== modified file 'lib/lp/bugs/doc/bug-tags.txt'
197--- lib/lp/bugs/doc/bug-tags.txt 2012-04-04 05:46:26 +0000
198+++ lib/lp/bugs/doc/bug-tags.txt 2012-08-03 02:45:24 +0000
199@@ -286,57 +286,26 @@
200 Tags for a context
201 ------------------
202
203-When viewing a bug listing for a context we want to display all the tags
204-that are used in that context. For this we have a method on each bug
205-target to return all the used tags. For source packages we return the
206-tags used in its distribution/distroseries, since it's good to see
207-which tags can be used. The tags are ordered alphabetically. All tags
208-are shown, no matter if they are used in open bugs or closed ones.
209-
210- >>> from lp.bugs.interfaces.bugtask import BugTaskStatus
211 >>> from lp.registry.interfaces.product import IProductSet
212 >>> firefox = getUtility(IProductSet).getByName('firefox')
213- >>> login('test@canonical.com')
214- >>> for bugtask in firefox.searchTasks(BugTaskSearchParams(
215- ... tag=all(u'layout-test'), user=None)):
216- ... bugtask.transitionToStatus(
217- ... BugTaskStatus.FIXRELEASED, getUtility(ILaunchBag).user)
218- >>> from lp.services.database.sqlbase import flush_database_updates
219- >>> flush_database_updates()
220-
221- >>> firefox.getUsedBugTags()
222- [u'doc', u'layout-test', u'sco', u'svg']
223-
224 >>> from lp.registry.interfaces.projectgroup import IProjectGroupSet
225 >>> mozilla = getUtility(IProjectGroupSet).getByName('mozilla')
226- >>> mozilla.getUsedBugTags()
227- [u'crash', u'doc', u'layout-test', u'sco', u'svg']
228-
229- >>> ubuntu.getUsedBugTags()
230- [u'crash', u'dataloss', u'pebcak', u'sco', u'svg']
231-
232 >>> ubuntu_thunderbird = ubuntu.getSourcePackage('thunderbird')
233- >>> ubuntu_thunderbird.getUsedBugTags()
234- [u'crash', u'dataloss', u'pebcak', u'sco', u'svg']
235-
236 >>> debian = getUtility(IDistributionSet).getByName('debian')
237 >>> debian_woody = debian.getSeries('woody')
238- >>> debian_woody.getUsedBugTags()
239- [u'dataloss', u'layout-test', u'pebcak']
240-
241 >>> debian_woody_firefox = (
242 ... debian_woody.getSourcePackage('mozilla-firefox'))
243- >>> debian_woody_firefox.getUsedBugTags()
244- [u'dataloss', u'layout-test', u'pebcak']
245
246-We can also get all the used tags, together with the number of open
247-bugs each tag has. Only tags having open bugs are returned.
248+When viewing a bug listing for a context we want to display all the tags
249+that are used in that context. We can also get all the used tags, together
250+with the number of open bugs each tag has. Only tags having open bugs are
251+returned.
252
253 >>> sorted(firefox.getUsedBugTagsWithOpenCounts(None).items())
254- [(u'doc', 1L), (u'sco', 1L), (u'svg', 1L)]
255+ [(u'doc', 1L), (u'layout-test', 1L), (u'sco', 1L), (u'svg', 1L)]
256
257 >>> sorted(mozilla.getUsedBugTagsWithOpenCounts(None).items())
258- [(u'doc', 1L), (u'sco', 1L), (u'svg', 1L)]
259+ [(u'doc', 1L), (u'layout-test', 1L), (u'sco', 1L), (u'svg', 1L)]
260
261 >>> sorted(ubuntu.getUsedBugTagsWithOpenCounts(None).items())
262 [(u'crash', 2L), (u'dataloss', 1L), (u'pebcak', 1L),
263@@ -378,17 +347,3 @@
264 True
265 >>> ubuntu_thunderbird.getUsedBugTagsWithOpenCounts(sample_person)
266 {u'crash': 1L}
267-
268-When context doesn't have any tags getUsedBugTags() returns a empty list.
269-
270- >>> gimp = getUtility(IProjectGroupSet).getByName('gimp')
271- >>> gimp.getUsedBugTags()
272- []
273-
274- >>> alsa = getUtility(IProductSet).getByName('alsa-utils')
275- >>> alsa.getUsedBugTags()
276- []
277-
278- >>> gentoo = getUtility(IDistributionSet).getByName('gentoo')
279- >>> gentoo.getUsedBugTags()
280- []
281
282=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
283--- lib/lp/bugs/interfaces/bugtarget.py 2012-07-10 09:51:13 +0000
284+++ lib/lp/bugs/interfaces/bugtarget.py 2012-08-03 02:45:24 +0000
285@@ -381,9 +381,6 @@
286 value_type=Tag(),
287 readonly=True))
288
289- def getUsedBugTags():
290- """Return the tags used by the context as a sorted list of strings."""
291-
292 def getUsedBugTagsWithOpenCounts(user, tag_limit=0, include_tags=None):
293 """Return name and bug count of tags having open bugs.
294
295
296=== modified file 'lib/lp/bugs/model/bug.py'
297--- lib/lp/bugs/model/bug.py 2012-08-03 00:30:51 +0000
298+++ lib/lp/bugs/model/bug.py 2012-08-03 02:45:24 +0000
299@@ -16,7 +16,6 @@
300 'BugTag',
301 'FileBugData',
302 'get_also_notified_subscribers',
303- 'get_bug_tags',
304 'get_bug_tags_open_count',
305 ]
306
307@@ -245,21 +244,6 @@
308 tag = StringCol(notNull=True)
309
310
311-def get_bug_tags(context_clause):
312- """Return all the bug tags as a list of strings.
313-
314- context_clause is a Storm clause, limiting the tags to a specific
315- context, which can only use the BugTask table to choose the context.
316- """
317- # Circular imports.
318- from lp.bugs.model.bugtask import BugTask
319-
320- return list(IStore(BugTag).find(
321- BugTag.tag,
322- BugTag.bugID == BugTask.bugID, context_clause).group_by(
323- BugTag.tag).order_by(BugTag.tag))
324-
325-
326 def get_bug_tags_open_count(context_condition, user, tag_limit=0,
327 include_tags=None):
328 """Worker for IBugTarget.getUsedBugTagsWithOpenCounts.
329
330=== modified file 'lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt'
331--- lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt 2012-06-22 17:02:50 +0000
332+++ lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt 2012-08-03 02:45:24 +0000
333@@ -32,14 +32,6 @@
334 >>> user_browser.getControl('Change').click()
335
336
337-Since they are new tags, we have to confirm them.
338-
339- >>> user_browser.url
340- 'http://bugs.launchpad.dev/firefox/+bug/1/+edit'
341- >>> user_browser.getControl('Create the new tag', index=0).click()
342- >>> user_browser.url
343- 'http://bugs.launchpad.dev/firefox/+bug/1'
344-
345 Now the tags will be displayed on the bug page:
346
347 >>> 'Tags:' in user_browser.contents
348@@ -87,27 +79,3 @@
349 >>> print_bugtasks(anon_browser.contents)
350 2 Blackhole Trash folder
351 &mdash; Medium New
352-
353-Using official tags for the first time does not require confirmation.
354-
355- >>> import transaction
356- >>> from zope.component import getUtility
357- >>> from lp.testing import login, logout
358- >>> from lp.registry.interfaces.product import IProductSet
359- >>> login('foo.bar@canonical.com')
360- >>> firefox = getUtility(IProductSet).getByName('firefox')
361- >>> u'an-official-tag' in firefox.getUsedBugTags()
362- False
363- >>> firefox.official_bug_tags = [u'an-official-tag']
364- >>> transaction.commit()
365- >>> logout()
366-
367- >>> user_browser.open('http://bugs.launchpad.dev/firefox/+bug/1/+edit')
368- >>> user_browser.getControl('Tags').value = 'an-official-tag'
369- >>> user_browser.getControl('Change').click()
370- >>> user_browser.getControl('Create the new tag')
371- Traceback (most recent call last):
372- ...
373- LookupError: label 'Create the new tag'
374- >>> print user_browser.url
375- http://bugs.launchpad.dev/firefox/+bug/1
376
377=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-activity.txt'
378--- lib/lp/bugs/stories/bugs/xx-bug-activity.txt 2012-07-17 21:41:42 +0000
379+++ lib/lp/bugs/stories/bugs/xx-bug-activity.txt 2012-08-03 02:45:24 +0000
380@@ -162,7 +162,6 @@
381 ... 'http://bugs.launchpad.dev/redfish/+bug/15/+edit')
382 >>> admin_browser.getControl("Tags").value = "tag1 tag2 tag3"
383 >>> admin_browser.getControl("Change").click()
384- >>> admin_browser.getControl('Create the new tag', index=0).click()
385
386 >>> admin_browser.open('http://launchpad.dev/bugs/15')
387 >>> print_comments(admin_browser.contents)
388@@ -182,7 +181,6 @@
389 ... 'http://bugs.launchpad.dev/redfish/+bug/15/+edit')
390 >>> admin_browser.getControl("Tags").value = "tag1 tag2 tag4"
391 >>> admin_browser.getControl("Change").click()
392- >>> admin_browser.getControl('Create the new tag', index=0).click()
393
394 >>> admin_browser.open('http://launchpad.dev/bugs/15')
395 >>> print_comments(admin_browser.contents)
396
397=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-edit.txt'
398--- lib/lp/bugs/stories/bugs/xx-bug-edit.txt 2012-06-16 13:21:23 +0000
399+++ lib/lp/bugs/stories/bugs/xx-bug-edit.txt 2012-08-03 02:45:24 +0000
400@@ -58,32 +58,13 @@
401 ----------------
402
403 When editing bug tags, we want to discourage people from adding new
404-tags. Therefore, if you try to add a tag that hasn't been used in the
405-current context before, you have to confirm that you indeed want to add
406-the tag.
407+tags.
408
409 >>> user_browser.open('http://bugs.launchpad.dev/firefox/+bug/1')
410 >>> user_browser.getLink(url="+edit").click()
411 >>> user_browser.url
412 'http://bugs.launchpad.dev/firefox/+bug/1/+edit'
413
414- >>> user_browser.getControl('Tags').value = 'new-tag'
415- >>> user_browser.getControl('Change').click()
416- >>> user_browser.url
417- 'http://bugs.launchpad.dev/firefox/+bug/1/+edit'
418- >>> print user_browser.contents
419- <...The tag "new-tag" hasn't been used by Mozilla Firefox before...
420-
421-Here we can confirm that we want to add the tag, or change the tag name
422-and submit the form again.
423-
424- >>> user_browser.getControl('Create the new tag') is not None
425- True
426- >>> user_browser.getControl('Change') is not None
427- True
428-
429-Let's edit it, changing it to an existing tag.
430-
431 >>> user_browser.getControl('Tags').value = 'layout-test'
432 >>> user_browser.getControl('Change').click()
433
434@@ -102,7 +83,6 @@
435 >>> user_browser.getControl('Tags').value = 'new-tag'
436 >>> user_browser.getControl('Change').click()
437
438- >>> user_browser.getControl('Create the new tag').click()
439 >>> user_browser.url
440 'http://bugs.launchpad.dev/firefox/+bug/1'
441
442
443=== removed file 'lib/lp/bugs/templates/bug-edit.pt'
444--- lib/lp/bugs/templates/bug-edit.pt 2009-08-21 15:33:18 +0000
445+++ lib/lp/bugs/templates/bug-edit.pt 1970-01-01 00:00:00 +0000
446@@ -1,22 +0,0 @@
447-<html
448- xmlns="http://www.w3.org/1999/xhtml"
449- xmlns:tal="http://xml.zope.org/namespaces/tal"
450- xmlns:metal="http://xml.zope.org/namespaces/metal"
451- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
452- metal:use-macro="view/macro:page/main_only"
453- i18n:domain="malone"
454->
455- <body>
456- <div metal:fill-slot="main">
457- <div metal:use-macro="context/@@launchpad_form/form">
458- <metal:extra_info metal:fill-slot="extra_info">
459- <p class="informational message"
460- tal:repeat="message view/notifications"
461- tal:content="structure message">
462- Confirmation message.
463- </p>
464- </metal:extra_info>
465- </div>
466- </div>
467- </body>
468-</html>
469
470=== modified file 'lib/lp/registry/configure.zcml'
471--- lib/lp/registry/configure.zcml 2012-07-13 08:29:56 +0000
472+++ lib/lp/registry/configure.zcml 2012-08-03 02:45:24 +0000
473@@ -504,7 +504,6 @@
474 findRelatedArchives
475 getMergeProposals
476 getReleasesAndPublishingHistory
477- getUsedBugTags
478 getUsedBugTagsWithOpenCounts
479 getVersion
480 get_distroseries_packages
481
482=== modified file 'lib/lp/registry/model/distribution.py'
483--- lib/lp/registry/model/distribution.py 2012-08-03 00:30:51 +0000
484+++ lib/lp/registry/model/distribution.py 2012-08-03 02:45:24 +0000
485@@ -81,15 +81,11 @@
486 DB_UNRESOLVED_BUGTASK_STATUSES,
487 )
488 from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
489-from lp.bugs.model.bug import (
490- BugSet,
491- get_bug_tags,
492- )
493+from lp.bugs.model.bug import BugSet
494 from lp.bugs.model.bugtarget import (
495 BugTargetBase,
496 OfficialBugTagTargetMixin,
497 )
498-from lp.bugs.model.bugtask import BugTask
499 from lp.bugs.model.structuralsubscription import (
500 StructuralSubscriptionTargetMixin,
501 )
502@@ -627,10 +623,6 @@
503 """Customize `search_params` for this distribution."""
504 search_params.setDistribution(self)
505
506- def getUsedBugTags(self):
507- """See `IBugTarget`."""
508- return get_bug_tags(BugTask.distributionID == self.id)
509-
510 def getBranchTips(self, user=None, since=None):
511 """See `IDistribution`."""
512 # This, ignoring privacy issues, is what we want.
513
514=== modified file 'lib/lp/registry/model/distributionsourcepackage.py'
515--- lib/lp/registry/model/distributionsourcepackage.py 2012-05-15 03:16:08 +0000
516+++ lib/lp/registry/model/distributionsourcepackage.py 2012-08-03 02:45:24 +0000
517@@ -482,10 +482,6 @@
518 """Customize `search_params` for this distribution source package."""
519 search_params.setSourcePackage(self)
520
521- def getUsedBugTags(self):
522- """See `IBugTarget`."""
523- return self.distribution.getUsedBugTags()
524-
525 def _getOfficialTagClause(self):
526 return self.distribution._getOfficialTagClause()
527
528
529=== modified file 'lib/lp/registry/model/distroseries.py'
530--- lib/lp/registry/model/distroseries.py 2012-08-01 07:10:54 +0000
531+++ lib/lp/registry/model/distroseries.py 2012-08-03 02:45:24 +0000
532@@ -55,9 +55,7 @@
533 from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
534 from lp.bugs.interfaces.bugtarget import ISeriesBugTarget
535 from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
536-from lp.bugs.model.bug import get_bug_tags
537 from lp.bugs.model.bugtarget import BugTargetBase
538-from lp.bugs.model.bugtask import BugTask
539 from lp.bugs.model.structuralsubscription import (
540 StructuralSubscriptionTargetMixin,
541 )
542@@ -781,10 +779,6 @@
543 """See `IHasBugs`."""
544 return self.distribution.official_bug_tags
545
546- def getUsedBugTags(self):
547- """See `IHasBugs`."""
548- return get_bug_tags(BugTask.distroseriesID == self.id)
549-
550 @property
551 def has_any_specifications(self):
552 """See IHasSpecifications."""
553
554=== modified file 'lib/lp/registry/model/product.py'
555--- lib/lp/registry/model/product.py 2012-08-03 00:30:51 +0000
556+++ lib/lp/registry/model/product.py 2012-08-03 02:45:24 +0000
557@@ -92,10 +92,7 @@
558 from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
559 from lp.bugs.interfaces.bugsupervisor import IHasBugSupervisor
560 from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
561-from lp.bugs.model.bug import (
562- BugSet,
563- get_bug_tags,
564- )
565+from lp.bugs.model.bug import BugSet
566 from lp.bugs.model.bugtarget import (
567 BugTargetBase,
568 OfficialBugTagTargetMixin,
569@@ -889,10 +886,6 @@
570 """Customize `search_params` for this product.."""
571 search_params.setProduct(self)
572
573- def getUsedBugTags(self):
574- """See `IBugTarget`."""
575- return get_bug_tags(BugTask.productID == self.id)
576-
577 series = SQLMultipleJoin('ProductSeries', joinColumn='product',
578 orderBy='name')
579
580
581=== modified file 'lib/lp/registry/model/productseries.py'
582--- lib/lp/registry/model/productseries.py 2012-08-01 07:10:54 +0000
583+++ lib/lp/registry/model/productseries.py 2012-08-03 02:45:24 +0000
584@@ -52,9 +52,7 @@
585 from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
586 from lp.bugs.interfaces.bugtarget import ISeriesBugTarget
587 from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
588-from lp.bugs.model.bug import get_bug_tags
589 from lp.bugs.model.bugtarget import BugTargetBase
590-from lp.bugs.model.bugtask import BugTask
591 from lp.bugs.model.structuralsubscription import (
592 StructuralSubscriptionTargetMixin,
593 )
594@@ -442,10 +440,6 @@
595 """See `IHasBugs`."""
596 return self.product.official_bug_tags
597
598- def getUsedBugTags(self):
599- """See IBugTarget."""
600- return get_bug_tags(BugTask.productseriesID == self.id)
601-
602 def createBug(self, bug_params):
603 """See IBugTarget."""
604 raise NotImplementedError('Cannot file a bug against a productseries')
605
606=== modified file 'lib/lp/registry/model/projectgroup.py'
607--- lib/lp/registry/model/projectgroup.py 2012-08-01 07:10:54 +0000
608+++ lib/lp/registry/model/projectgroup.py 2012-08-03 02:45:24 +0000
609@@ -56,12 +56,10 @@
610 )
611 from lp.blueprints.model.sprint import HasSprintsMixin
612 from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
613-from lp.bugs.model.bug import get_bug_tags
614 from lp.bugs.model.bugtarget import (
615 BugTargetBase,
616 OfficialBugTag,
617 )
618-from lp.bugs.model.bugtask import BugTask
619 from lp.bugs.model.structuralsubscription import (
620 StructuralSubscriptionTargetMixin,
621 )
622@@ -334,13 +332,6 @@
623 result.config(distinct=True)
624 return result
625
626- def getUsedBugTags(self):
627- """See `IHasBugs`."""
628- if not self.products:
629- return []
630- return get_bug_tags(
631- BugTask.productID.is_in([p.id for p in self.products]))
632-
633 def getBugSummaryContextWhereClause(self):
634 """See BugTargetBase."""
635 # Circular fail.
636
637=== modified file 'lib/lp/registry/model/sourcepackage.py'
638--- lib/lp/registry/model/sourcepackage.py 2012-05-14 05:20:36 +0000
639+++ lib/lp/registry/model/sourcepackage.py 2012-08-03 02:45:24 +0000
640@@ -504,10 +504,6 @@
641 """See `IHasBugs`."""
642 return self.distroseries.official_bug_tags
643
644- def getUsedBugTags(self):
645- """See `IBugTarget`."""
646- return self.distroseries.getUsedBugTags()
647-
648 def getUsedBugTagsWithOpenCounts(self, user, tag_limit=0,
649 include_tags=None):
650 """See IBugTarget."""