launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12902
lp:~wallyworld/launchpad/dynamic-bug-listing-nominations2-1060015 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/dynamic-bug-listing-nominations2-1060015 into lp:launchpad.
Commit message:
Remove the bulk editing of bug nominations back end code since the UI now no longer supports it.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1060015 in Launchpad itself: "Dynamic bug lists to not render nomination controls"
https://bugs.launchpad.net/launchpad/+bug/1060015
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/dynamic-bug-listing-nominations2-1060015/+merge/127922
== Implementation ==
The UI no longer provides the ability to bulk edit bug nominations. It is also not very useful because there's not enough info to make a decision; each individual bug typically needs to be clicked and approved/declined from the bug page.
Delete the back end code which supports this functionality.
== Tests ==
Delete now unused doc test.
--
https://code.launchpad.net/~wallyworld/launchpad/dynamic-bug-listing-nominations2-1060015/+merge/127922
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/dynamic-bug-listing-nominations2-1060015 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2012-10-03 02:32:16 +0000
+++ lib/lp/bugs/browser/bugtask.py 2012-10-04 01:58:22 +0000
@@ -37,7 +37,6 @@
'get_comments_for_bugtask',
'get_sortorder_from_request',
'get_visible_comments',
- 'NominationsReviewTableBatchNavigatorView',
'TextualBugTaskSearchListingView',
]
@@ -55,10 +54,6 @@
import urlparse
from lazr.delegates import delegates
-from lazr.enum import (
- EnumeratedType,
- Item,
- )
from lazr.lifecycle.event import ObjectModifiedEvent
from lazr.lifecycle.snapshot import Snapshot
from lazr.restful.interface import copy_field
@@ -82,11 +77,7 @@
)
from zope.app.form import CustomWidgetFactory
from zope.app.form.browser.itemswidgets import RadioWidget
-from zope.app.form.interfaces import (
- IInputWidget,
- InputErrors,
- )
-from zope.app.form.utility import setUpWidget
+from zope.app.form.interfaces import InputErrors
from zope.app.security.interfaces import IUnauthenticatedPrincipal
from zope.component import (
ComponentLookupError,
@@ -178,7 +169,6 @@
BugTaskTargetWidget,
DBItemDisplayWidget,
NewLineToSpacesWidget,
- NominationReviewActionWidget,
)
from lp.bugs.interfaces.bug import (
IBug,
@@ -204,7 +194,6 @@
IBugTaskSet,
ICreateQuestionFromBugTaskForm,
IllegalTarget,
- INominationsReviewTableBatchNavigator,
IRemoveQuestionFromBugTaskForm,
UNRESOLVED_BUGTASK_STATUSES,
UserCannotEditBugTaskStatus,
@@ -2402,72 +2391,6 @@
return {'items': items}
-class NominatedBugReviewAction(EnumeratedType):
- """Enumeration for nomination review actions"""
-
- ACCEPT = Item("""
- Accept
-
- Accept the bug nomination.
- """)
-
- DECLINE = Item("""
- Decline
-
- Decline the bug nomination.
- """)
-
- NO_CHANGE = Item("""
- No change
-
- Do not change the status of the bug nomination.
- """)
-
-
-class NominatedBugListingBatchNavigator(BugListingBatchNavigator):
- """Batch navigator for nominated bugtasks. """
-
- implements(INominationsReviewTableBatchNavigator)
-
- def __init__(self, tasks, request, columns_to_show, size,
- nomination_target, user):
- BugListingBatchNavigator.__init__(
- self, tasks, request, columns_to_show, size)
- self.nomination_target = nomination_target
- self.user = user
-
- def _getListingItem(self, bugtask):
- """See BugListingBatchNavigator."""
- bugtask_listing_item = BugListingBatchNavigator._getListingItem(
- self, bugtask)
- bug_nomination = bugtask_listing_item.bug.getNominationFor(
- self.nomination_target)
- if self.user is None or not bug_nomination.canApprove(self.user):
- return bugtask_listing_item
-
- review_action_field = Choice(
- __name__='review_action_%d' % bug_nomination.id,
- vocabulary=NominatedBugReviewAction,
- title=u'Review action', required=True)
-
- # This is so setUpWidget expects a view, and so
- # view.request. We're not passing a view but we still want it
- # to work.
- bugtask_listing_item.request = self.request
-
- bugtask_listing_item.review_action_widget = CustomWidgetFactory(
- NominationReviewActionWidget)
- setUpWidget(
- bugtask_listing_item,
- 'review_action',
- review_action_field,
- IInputWidget,
- value=NominatedBugReviewAction.NO_CHANGE,
- context=bug_nomination)
-
- return bugtask_listing_item
-
-
class IBugTaskSearchListingMenu(Interface):
"""A marker interface for the search listing navigation menu."""
@@ -3413,14 +3336,6 @@
class BugNominationsView(BugTaskSearchListingView):
"""View for accepting/declining bug nominations."""
- def _getBatchNavigator(self, tasks):
- """See BugTaskSearchListingView."""
- batch_navigator = NominatedBugListingBatchNavigator(
- tasks, self.request, columns_to_show=self.columns_to_show,
- size=config.malone.buglist_batch_size,
- nomination_target=self.context, user=self.user)
- return batch_navigator
-
def search(self):
"""Return all the nominated tasks for this series."""
if IDistroSeries.providedBy(self.context):
@@ -3435,60 +3350,6 @@
extra_params=dict(nominated_for=self.context))
-class NominationsReviewTableBatchNavigatorView(LaunchpadFormView):
- """View for displaying a list of nominated bugs."""
-
- def canApproveNominations(self, action=None):
- """Whether the user can approve any of the shown nominations."""
- return len(list(self.widgets)) > 0
-
- def setUpFields(self):
- """See LaunchpadFormView."""
- # We set up the widgets ourselves.
- self.form_fields = []
-
- def setUpWidgets(self):
- """See LaunchpadFormView."""
- widgets_list = [
- (True, bug_listing_item.review_action_widget)
- for bug_listing_item in self.context.getBugListingItems()
- if bug_listing_item.review_action_widget is not None]
- self.widgets = formlib.form.Widgets(
- widgets_list, len(self.prefix) + 1)
-
- @action('Save changes', name='submit', condition=canApproveNominations)
- def submit_action(self, action, data):
- """Accept/Decline bug nominations."""
- accepted = declined = 0
-
- for name, review_action in data.items():
- if review_action == NominatedBugReviewAction.NO_CHANGE:
- continue
- field = self.widgets[name].context
- bug_nomination = field.context
- if review_action == NominatedBugReviewAction.ACCEPT:
- bug_nomination.approve(self.user)
- accepted += 1
- elif review_action == NominatedBugReviewAction.DECLINE:
- bug_nomination.decline(self.user)
- declined += 1
- else:
- raise AssertionError(
- 'Unknown NominatedBugReviewAction: %r' % review_action)
-
- if accepted > 0:
- self.request.response.addInfoNotification(
- '%d nomination(s) accepted' % accepted)
- if declined > 0:
- self.request.response.addInfoNotification(
- '%d nomination(s) declined' % declined)
-
- self.next_url = self.request.getURL()
- query_string = self.request.get('QUERY_STRING')
- if query_string:
- self.next_url += '?%s' % query_string
-
-
class BugTargetView(LaunchpadView):
"""Used to grab bugs for a bug target; used by the latest bugs portlet"""
=== modified file 'lib/lp/bugs/browser/configure.zcml'
--- lib/lp/bugs/browser/configure.zcml 2012-08-21 00:34:02 +0000
+++ lib/lp/bugs/browser/configure.zcml 2012-10-04 01:58:22 +0000
@@ -1167,13 +1167,6 @@
template="../templates/bugs-listing-table-without-navlinks.pt"
permission="zope.Public" />
- <browser:page
- for="lp.bugs.interfaces.bugtask.INominationsReviewTableBatchNavigator"
- class="lp.bugs.browser.bugtask.NominationsReviewTableBatchNavigatorView"
- name="+table-view-without-navlinks"
- template="../templates/bugs-listing-nominations-table-without-navlinks.pt"
- permission="zope.Public" />
-
</facet>
<browser:defaultView
for="lp.registry.interfaces.distribution.IDistribution"
=== modified file 'lib/lp/bugs/browser/widgets/bugtask.py'
--- lib/lp/bugs/browser/widgets/bugtask.py 2012-08-29 06:24:05 +0000
+++ lib/lp/bugs/browser/widgets/bugtask.py 2012-10-04 01:58:22 +0000
@@ -14,7 +14,6 @@
"BugWatchEditForm",
"DBItemDisplayWidget",
"NewLineToSpacesWidget",
- "NominationReviewActionWidget",
"UbuntuSourcePackageNameWidget",
]
@@ -56,7 +55,6 @@
)
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
from lp.app.widgets.helpers import get_widget_template
-from lp.app.widgets.itemswidgets import LaunchpadRadioWidget
from lp.app.widgets.launchpadtarget import LaunchpadTargetWidget
from lp.app.widgets.popup import (
PersonPickerWidget,
@@ -624,17 +622,3 @@
lines = value.splitlines()
value = ' '.join(lines)
return value
-
-
-class NominationReviewActionWidget(LaunchpadRadioWidget):
- """Widget for choosing a nomination review action.
-
- It renders a radio box with no label for each option.
- """
- orientation = "horizontal"
-
- # The label will always be the empty string.
- _joinButtonToMessageTemplate = '%s%s'
-
- def textForValue(self, term):
- return u''
=== modified file 'lib/lp/bugs/interfaces/bugtask.py'
--- lib/lp/bugs/interfaces/bugtask.py 2012-08-29 06:24:05 +0000
+++ lib/lp/bugs/interfaces/bugtask.py 2012-10-04 01:58:22 +0000
@@ -23,7 +23,6 @@
'IBugTaskSet',
'ICreateQuestionFromBugTaskForm',
'IllegalTarget',
- 'INominationsReviewTableBatchNavigator',
'IRemoveQuestionFromBugTaskForm',
'normalize_bugtask_status',
'RESOLVED_BUGTASK_STATUSES',
@@ -97,7 +96,6 @@
StrippedTextLine,
Summary,
)
-from lp.services.webapp.interfaces import ITableBatchNavigator
class BugTaskImportance(DBEnumeratedType):
@@ -1077,10 +1075,6 @@
summary = Summary(title=_('Project summary'), required=True)
-class INominationsReviewTableBatchNavigator(ITableBatchNavigator):
- """Marker interface to render custom template for the bug nominations."""
-
-
class ICreateQuestionFromBugTaskForm(Interface):
"""Form for creating and question from a bug."""
comment = Text(
=== removed file 'lib/lp/bugs/stories/bug-release-management/xx-review-nominated-bugs.txt'
--- lib/lp/bugs/stories/bug-release-management/xx-review-nominated-bugs.txt 2012-10-02 06:36:44 +0000
+++ lib/lp/bugs/stories/bug-release-management/xx-review-nominated-bugs.txt 1970-01-01 00:00:00 +0000
@@ -1,67 +0,0 @@
-Review Nominated Bugs
-=====================
-
-Distribution Series
--------------------
-
-From the distribution series bug page you can go to a page to review
-all the bugs nominated for this series.
-
- >>> anon_browser.open('http://bugs.launchpad.dev/ubuntu/hoary')
- >>> anon_browser.getLink('Review nominations').click()
- >>> print anon_browser.title
- Bugs : Hoary : Bugs : Hoary (5.04) : Ubuntu
-
-All the basic bug details are displayed.
-
- >>> from lp.bugs.tests.bug import print_bugtasks
- >>> print_bugtasks(anon_browser.contents)
- 1 Firefox does not support SVG mozilla-firefox (Ubuntu) Medium New
-
-There are no controls for approving/declining the nominations if the
-user don't have permissions to do it.
-
- >>> user_browser.open('http://bugs.launchpad.dev/ubuntu/hoary')
- >>> user_browser.getLink('Review nominations').click()
- >>> print anon_browser.title
- Bugs : Hoary : Bugs : Hoary (5.04) : Ubuntu
-
- >>> print_bugtasks(user_browser.contents)
- 1 Firefox does not support SVG mozilla-firefox (Ubuntu) Medium New
-
- >>> bug_listing = find_tag_by_id(user_browser.contents, 'bugs-table-listing')
- >>> def print_which_items_have_widgets(bug_listing):
- ... for row in bug_listing('div', {'class': 'buglisting-row'}):
- ... bug_id = extract_text(
- ... row.find(None, {'class': 'bugnumber'})).replace('#', '')
- ... has_input_controls = False
- ... print "%s: %s" % (extract_text(bug_id), has_input_controls)
- >>> print_which_items_have_widgets(bug_listing)
- 1: False
-
-No button for submitting the form is shown, nor is the approve/decline
-header:
-
- >>> user_browser.getControl('Save changes')
- Traceback (most recent call last):
- ...
- LookupError: label 'Save changes'
-
-Someone with enough permissions sees controls for approving/declining
-nominations.
-
- >>> admin_browser.open('http://bugs.launchpad.dev/ubuntu/hoary')
- >>> admin_browser.getLink('Review nominations').click()
- >>> print anon_browser.title
- Bugs : Hoary : Bugs : Hoary (5.04) : Ubuntu
-
- >>> print_bugtasks(admin_browser.contents)
- 1 Firefox does not support SVG mozilla-firefox (Ubuntu) Medium New
-
- >>> bug_listing = find_tag_by_id(admin_browser.contents, 'bugs-table-listing')
- >>> print_which_items_have_widgets(bug_listing)
- 1: False
-
-XXX wallyworld 2012-10-02 bug=1060015
-The dynamic bug listings feature has broken the ability to manage nominations.
-Some doc tests have been removed till the functionality is restored.
=== removed file 'lib/lp/bugs/templates/bugs-listing-nominations-table-without-navlinks.pt'
--- lib/lp/bugs/templates/bugs-listing-nominations-table-without-navlinks.pt 2012-03-10 15:08:09 +0000
+++ lib/lp/bugs/templates/bugs-listing-nominations-table-without-navlinks.pt 1970-01-01 00:00:00 +0000
@@ -1,59 +0,0 @@
-<form
- xmlns:tal="http://xml.zope.org/namespaces/tal"
- xmlns:metal="http://xml.zope.org/namespaces/metal"
- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
- method="post"
- tal:attributes="action request/URL"
- condition="context/batch">
- <table class="listing" id="buglisting">
- <thead>
- <tr>
- <th tal:condition="view/canApproveNominations">
- <div style="text-align: left">Accept</div>
- <div style="text-align: center">Decline</div>
- <div style="text-align: right">No change</div>
- </th>
- <th colspan="3">Summary</th>
- <th tal:condition="context/show_column/packagename|nothing">
- Package
- </th>
- <th>Importance</th>
- <th>Status</th>
- </tr>
- </thead>
- <tbody>
- <tr tal:repeat="bugtask context/getBugListingItems">
- <td tal:content="structure bugtask/review_action_widget"
- tal:condition="view/canApproveNominations">
- <input type="radio" value="accept" />
- <input type="radio" value="decline" />
- <input type="radio" value="no-change" />
- </td>
- <td class="icon right">
- <img src="/@@/bug" tal:replace="structure bugtask/image:icon" />
- </td>
- <td
- class="amount"
- tal:content="bugtask/bug/id"
- >42</td>
- <td>
- <a href="#"
- tal:content="bugtask/bug/title"
- tal:attributes="href bugtask/fmt:url">
- drop-down list in search bar disappears when using blah blah blah
- </a>
- <img src="/@@/info" tal:replace="structure bugtask/image:badges" />
- </td>
- <tal:sourcepackage tal:condition="context/show_column/packagename|nothing">
- <td tal:condition="bugtask/sourcepackagename"
- tal:content="structure bugtask/sourcepackagename/name"
- >mozilla-firefox (Ubuntu)</td>
- <td tal:condition="not: bugtask/sourcepackagename">—</td>
- </tal:sourcepackage>
- <td tal:content="bugtask/importance/title">Critical</td>
- <td tal:content="bugtask/status/title">Confirmed</td>
- </tr>
- </tbody>
- </table>
- <tal:submit tal:replace="structure view/submit_action/render" />
-</form>
Follow ups