← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/no-packagebugs-search into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/no-packagebugs-search into lp:launchpad.

Commit message:
Switch Person:+packagebugs's links from Person:+packagebugs-search to DSP:+bugs, and kill +packagebugs-search entirely.

Requested reviews:
  William Grant (wgrant): code

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/no-packagebugs-search/+merge/243201

Switch Person:+packagebugs's links from Person:+packagebugs-search to DSP:+bugs, and kill +packagebugs-search entirely.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/bugs/browser/configure.zcml'
--- lib/lp/bugs/browser/configure.zcml	2014-11-24 06:20:03 +0000
+++ lib/lp/bugs/browser/configure.zcml	2014-11-29 03:35:33 +0000
@@ -308,12 +308,6 @@
         permission="zope.Public"
         template="../templates/buglisting-embedded-advanced-search.pt"/>
     <browser:page
-        name="+packagebugs-search"
-        for="lp.registry.interfaces.person.IPerson"
-        class="lp.bugs.browser.person.BugSubscriberPackageBugsSearchListingView"
-        permission="zope.Public"
-        template="../templates/person-packagebugs-search.pt"/>
-    <browser:page
         name="+packagebugs"
         for="lp.registry.interfaces.person.IPerson"
         class="lp.bugs.browser.person.BugSubscriberPackageBugsOverView"

=== modified file 'lib/lp/bugs/browser/person.py'
--- lib/lp/bugs/browser/person.py	2012-04-17 07:54:24 +0000
+++ lib/lp/bugs/browser/person.py	2014-11-29 03:35:33 +0000
@@ -6,7 +6,6 @@
 __metaclass__ = type
 
 __all__ = [
-    'BugSubscriberPackageBugsSearchListingView',
     'PersonBugsMenu',
     'PersonCommentedBugTaskSearchListingView',
     'PersonAssignedBugTaskSearchListingView',
@@ -22,9 +21,7 @@
 import urllib
 
 from zope.component import getUtility
-from zope.schema.vocabulary import getVocabularyRegistry
 
-from lp.app.errors import UnexpectedFormData
 from lp.bugs.browser.bugtask import BugTaskSearchListingView
 from lp.bugs.interfaces.bugtask import (
     BugTaskStatus,
@@ -38,7 +35,6 @@
     )
 from lp.services.database.bulk import load_related
 from lp.services.feeds.browser import FeedsMixin
-from lp.services.helpers import shortlist
 from lp.services.propertycache import cachedproperty
 from lp.services.webapp.batching import BatchNavigator
 from lp.services.webapp.menu import (
@@ -51,32 +47,25 @@
     )
 
 
-def get_package_search_url(distributionsourcepackage, person_url,
-                           advanced=False, extra_params=None):
+def get_package_search_url(dsp_bugs_url, extra_params=None):
     """Construct a default search URL for a distributionsourcepackage.
 
     Optional filter parameters can be specified as a dict with the
     extra_params argument.
     """
     params = {
-        "field.distribution": distributionsourcepackage.distribution.name,
-        "field.sourcepackagename": distributionsourcepackage.name,
-        "search": "Search"}
-    if advanced:
-        params['advanced'] = '1'
-
+        "search": "Search",
+        "field.status": [
+            status.title for status in UNRESOLVED_BUGTASK_STATUSES]}
     if extra_params is not None:
         # We must UTF-8 encode searchtext to play nicely with
         # urllib.urlencode, because it may contain non-ASCII characters.
         if 'field.searchtext' in extra_params:
             extra_params["field.searchtext"] = (
                 extra_params["field.searchtext"].encode("utf8"))
-
         params.update(extra_params)
-
-    query_string = urllib.urlencode(sorted(params.items()), doseq=True)
-
-    return person_url + '/+packagebugs-search?%s' % query_string
+    return '%s?%s' % (
+        dsp_bugs_url, urllib.urlencode(sorted(params.items()), doseq=True))
 
 
 class PersonBugsMenu(NavigationMenu):
@@ -177,178 +166,28 @@
         L = []
         package_counts = getUtility(IBugTaskSet).getBugCountsForPackages(
             self.user, self.context.getBugSubscriberPackages())
-        person_url = canonical_url(self.context)
         for package_counts in package_counts:
-            package = package_counts['package']
+            url = canonical_url(package_counts['package'], rootsite='bugs')
             L.append({
-                'package_name': package.displayname,
-                'package_search_url':
-                    get_package_search_url(package, person_url),
+                'package_name': package_counts['package'].displayname,
+                'package_search_url': get_package_search_url(url),
                 'open_bugs_count': package_counts['open'],
-                'open_bugs_url': self.getOpenBugsURL(package, person_url),
+                'open_bugs_url': get_package_search_url(url),
                 'critical_bugs_count': package_counts['open_critical'],
-                'critical_bugs_url': self.getCriticalBugsURL(
-                    package, person_url),
+                'critical_bugs_url': get_package_search_url(
+                    url, {'field.importance': 'Critical'}),
                 'high_bugs_count': package_counts['open_high'],
-                'high_bugs_url': self.getHighBugsURL(package, person_url),
+                'high_bugs_url': get_package_search_url(
+                    url, {'field.importance': 'High'}),
                 'unassigned_bugs_count': package_counts['open_unassigned'],
-                'unassigned_bugs_url': self.getUnassignedBugsURL(
-                    package, person_url),
+                'unassigned_bugs_url': get_package_search_url(
+                    url, {'assignee_option': 'none'}),
                 'inprogress_bugs_count': package_counts['open_inprogress'],
-                'inprogress_bugs_url': self.getInProgressBugsURL(
-                    package, person_url),
+                'inprogress_bugs_url': get_package_search_url(
+                    url, {'field.status': 'In Progress'}),
             })
-
         return sorted(L, key=itemgetter('package_name'))
 
-    def getOpenBugsURL(self, distributionsourcepackage, person_url):
-        """Return the URL for open bugs on distributionsourcepackage."""
-        status_params = {'field.status': []}
-
-        for status in UNRESOLVED_BUGTASK_STATUSES:
-            status_params['field.status'].append(status.title)
-
-        return get_package_search_url(
-            distributionsourcepackage=distributionsourcepackage,
-            person_url=person_url,
-            extra_params=status_params)
-
-    def getCriticalBugsURL(self, distributionsourcepackage, person_url):
-        """Return the URL for critical bugs on distributionsourcepackage."""
-        critical_bugs_params = {
-            'field.status': [], 'field.importance': "Critical"}
-
-        for status in UNRESOLVED_BUGTASK_STATUSES:
-            critical_bugs_params["field.status"].append(status.title)
-
-        return get_package_search_url(
-            distributionsourcepackage=distributionsourcepackage,
-            person_url=person_url,
-            extra_params=critical_bugs_params)
-
-    def getHighBugsURL(self, distributionsourcepackage, person_url):
-        """Return URL for high bugs on distributionsourcepackage."""
-        high_bugs_params = {
-            'field.status': [], 'field.importance': "High"}
-
-        for status in UNRESOLVED_BUGTASK_STATUSES:
-            high_bugs_params["field.status"].append(status.title)
-
-        return get_package_search_url(
-            distributionsourcepackage=distributionsourcepackage,
-            person_url=person_url,
-            extra_params=high_bugs_params)
-
-    def getUnassignedBugsURL(self, distributionsourcepackage, person_url):
-        """Return the URL for unassigned bugs on distributionsourcepackage."""
-        unassigned_bugs_params = {
-            "field.status": [], "field.unassigned": "on"}
-
-        for status in UNRESOLVED_BUGTASK_STATUSES:
-            unassigned_bugs_params["field.status"].append(status.title)
-
-        return get_package_search_url(
-            distributionsourcepackage=distributionsourcepackage,
-            person_url=person_url,
-            extra_params=unassigned_bugs_params)
-
-    def getInProgressBugsURL(self, distributionsourcepackage, person_url):
-        """Return the URL for unassigned bugs on distributionsourcepackage."""
-        inprogress_bugs_params = {"field.status": "In Progress"}
-
-        return get_package_search_url(
-            distributionsourcepackage=distributionsourcepackage,
-            person_url=person_url,
-            extra_params=inprogress_bugs_params)
-
-
-class BugSubscriberPackageBugsSearchListingView(BugTaskSearchListingView):
-    """Bugs reported on packages for a bug subscriber."""
-
-    columns_to_show = ["id", "summary", "importance", "status"]
-    page_title = 'Package bugs'
-
-    @property
-    def current_package(self):
-        """Get the package whose bugs are currently being searched."""
-        if not (
-            self.widgets['distribution'].hasValidInput() and
-            self.widgets['distribution'].getInputValue()):
-            raise UnexpectedFormData("A distribution is required")
-        if not (
-            self.widgets['sourcepackagename'].hasValidInput() and
-            self.widgets['sourcepackagename'].getInputValue()):
-            raise UnexpectedFormData("A sourcepackagename is required")
-
-        distribution = self.widgets['distribution'].getInputValue()
-        return distribution.getSourcePackage(
-            self.widgets['sourcepackagename'].getInputValue())
-
-    def search(self, searchtext=None):
-        distrosourcepackage = self.current_package
-        return BugTaskSearchListingView.search(
-            self, searchtext=searchtext, context=distrosourcepackage)
-
-    def getMilestoneWidgetValues(self):
-        """See `BugTaskSearchListingView`.
-
-        We return only the active milestones on the current distribution
-        since any others are irrelevant.
-        """
-        current_distro = self.current_package.distribution
-        vocabulary_registry = getVocabularyRegistry()
-        vocabulary = vocabulary_registry.get(current_distro, 'Milestone')
-
-        return shortlist([
-            dict(title=milestone.title, value=milestone.token, checked=False)
-            for milestone in vocabulary],
-            longest_expected=10)
-
-    @cachedproperty
-    def person_url(self):
-        return canonical_url(self.context)
-
-    def getBugSubscriberPackageSearchURL(self, distributionsourcepackage=None,
-                                         advanced=False, extra_params=None):
-        """Construct a default search URL for a distributionsourcepackage.
-
-        Optional filter parameters can be specified as a dict with the
-        extra_params argument.
-        """
-        if distributionsourcepackage is None:
-            distributionsourcepackage = self.current_package
-        return get_package_search_url(
-            distributionsourcepackage, self.person_url, advanced,
-            extra_params)
-
-    def getBugSubscriberPackageAdvancedSearchURL(self,
-                                              distributionsourcepackage=None):
-        """Build the advanced search URL for a distributionsourcepackage."""
-        return self.getBugSubscriberPackageSearchURL(advanced=True)
-
-    def shouldShowSearchWidgets(self):
-        # XXX: Guilherme Salgado 2005-11-05:
-        # It's not possible to search amongst the bugs on maintained
-        # software, so for now I'll be simply hiding the search widgets.
-        return False
-
-    # Methods that customize the advanced search form.
-    def getAdvancedSearchButtonLabel(self):
-        return "Search bugs in %s" % self.current_package.displayname
-
-    def getSimpleSearchURL(self):
-        return get_package_search_url(self.current_package, self.person_url)
-
-    @property
-    def label(self):
-        return self.getSearchPageHeading()
-
-    @property
-    def context_description(self):
-        """See `BugTaskSearchListingView`."""
-        return ("in %s related to %s" %
-                (self.current_package.displayname, self.context.displayname))
-
 
 class PersonAssignedBugTaskSearchListingView(RelevantMilestonesMixin,
                                              BugTaskSearchListingView):

=== modified file 'lib/lp/bugs/browser/tests/person-bug-views.txt'
--- lib/lp/bugs/browser/tests/person-bug-views.txt	2014-01-30 15:04:06 +0000
+++ lib/lp/bugs/browser/tests/person-bug-views.txt	2014-11-29 03:35:33 +0000
@@ -174,103 +174,7 @@
 -----------------------
 
 Malone can generate bug reports for packages on which a user is a bug
-supervisor. The Person context is used only to get a list of packages that
-the user has chosen to subscribe to, but any package could be searched
-from these reports, simply by hacking the URL.
-
-    >>> form = {
-    ...     'search': "Search", 'field.distribution': "debian",
-    ...     'field.sourcepackagename': "mozilla-firefox"}
-
-    >>> packagebugs_search_view = create_view(
-    ...     name12, name="+packagebugs-search", form=form)
-
-Let's look at some example searches:
-
-No search criteria (ordered by importance):
-
-    >>> bugtask_batch_navigator = packagebugs_search_view.search()
-    >>> [(bugtask.bug.id, bugtask.importance.name)
-    ...  for bugtask in bugtask_batch_navigator.batch]
-    [(3, 'UNKNOWN'),
-     (1, 'LOW'),
-     (2, 'LOW')]
-
-Simple keyword searching:
-
-    >>> form = {
-    ...     'search': "Search",
-    ...     'field.distribution': "debian",
-    ...     'field.sourcepackagename': "mozilla-firefox",
-    ...     'field.searchtext': "trash"}
-
-    >>> packagebugs_search_view = create_view(
-    ...     name12, name="+packagebugs-search", form=form)
-
-    >>> bugtask_batch_navigator = packagebugs_search_view.search()
-    >>> [bugtask.bug.id for bugtask in bugtask_batch_navigator.batch]
-    [2]
-
-Searching for all open bugs on Debian mozilla-firefox:
-
-    >>> from lp.bugs.interfaces.bugtask import (
-    ...     UNRESOLVED_BUGTASK_STATUSES)
-
-    >>> form = {
-    ...     'search': "Search",
-    ...     'field.distribution': "debian",
-    ...     'field.sourcepackagename': "mozilla-firefox",
-    ...     'field.status': [s.title for s in UNRESOLVED_BUGTASK_STATUSES]}
-
-    >>> packagebugs_search_view = create_view(
-    ...     name12, name="+packagebugs-search", form=form)
-
-    >>> bugtask_batch_navigator = packagebugs_search_view.search()
-    >>> [(bugtask.bug.id, bugtask.importance.name)
-    ...  for bugtask in bugtask_batch_navigator.batch]
-    [(3, 'UNKNOWN'),
-     (1, 'LOW'),
-     (2, 'LOW')]
-
-There are helper methods to calculate links to the Open, Critical,
-Unassigned, and In Progress bug lists.
-
-    >>> from zope.component import getUtility
-    >>> from lp.registry.interfaces.distribution import IDistributionSet
-
-    >>> ubuntu = getUtility(IDistributionSet).getByName("ubuntu")
-    >>> ubuntu_mozilla_firefox = ubuntu.getSourcePackage("mozilla-firefox")
-    >>> packagebugs_view = create_view(name12, name='+packagebugs')
-
-    >>> packagebugs_view.getOpenBugsURL(
-    ...     ubuntu_mozilla_firefox, u'/~name12')
-    u'.../~name12/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
-
-    >>> packagebugs_view.getCriticalBugsURL(
-    ...     ubuntu_mozilla_firefox, u'/~name12')
-    u'.../~name12/+packagebugs-search?field.distribution=ubuntu&field.importance=Critical&field.sourcepackagename=mozilla-firefox&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
-
-    >>> packagebugs_view.getUnassignedBugsURL(
-    ...     ubuntu_mozilla_firefox, u'/~name12')
-    u'.../~name12/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&field.unassigned=on&search=Search'
-
-    >>> packagebugs_view.getInProgressBugsURL(
-    ...     ubuntu_mozilla_firefox, u'/~name12')
-    u'.../~name12/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&field.status=In+Progress&search=Search'
-
-A helper method is used to calculate the package bug search URL for the
-"My other packages" portlet:
-
-    >>> packagebugs_search_view.getBugSubscriberPackageSearchURL(
-    ...     ubuntu_mozilla_firefox)
-    u'.../~name12/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&search=Search'
-
-There's also a getBugSubscriberPackageAdvancedSearchURL method. If called
-without a package argument, it defaults to the "current package", found
-by looking in the request.
-
-    >>> packagebugs_search_view.getBugSubscriberPackageAdvancedSearchURL()
-    u'.../~name12/+packagebugs-search?advanced=1&field.distribution=debian&field.sourcepackagename=mozilla-firefox&search=Search'
+supervisor.
 
 Finally, there is a helper method that returns a list of dicts used to
 render the overview report.
@@ -286,7 +190,7 @@
     >>> ubuntu_firefox_bugcounts['package_name']
     u'mozilla-firefox in Ubuntu'
     >>> ubuntu_firefox_bugcounts['package_search_url']
-    u'.../~name16/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&search=Search'
+    u'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox?field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
 
     >>> print ubuntu_firefox_bugcounts['open_bugs_count']
     1
@@ -298,13 +202,13 @@
     0
 
     >>> ubuntu_firefox_bugcounts['open_bugs_url']
-    u'.../~name16/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
+    u'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox?field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
     >>> ubuntu_firefox_bugcounts['critical_bugs_url']
-    u'.../~name16/+packagebugs-search?field.distribution=ubuntu&field.importance=Critical&field.sourcepackagename=mozilla-firefox&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
+    u'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox?field.importance=Critical&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
     >>> ubuntu_firefox_bugcounts['unassigned_bugs_url']
-    u'.../~name16/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&field.unassigned=on&search=Search'
+    u'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox?assignee_option=none&field.status=New&field.status=Incomplete&field.status=Confirmed&field.status=Triaged&field.status=In+Progress&field.status=Fix+Committed&search=Search'
     >>> ubuntu_firefox_bugcounts['inprogress_bugs_url']
-    u'.../~name16/+packagebugs-search?field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&field.status=In+Progress&search=Search'
+    u'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox?field.status=In+Progress&search=Search'
 
 The total number of bugs, broken down in the same ways as the package
 bug counts, is also available.
@@ -322,9 +226,13 @@
 Adding another bug will update the totals returned by
 packagebugs_search_view.total_bug_counts.
 
+    >>> import transaction
+    >>> from zope.component import getUtility
     >>> from lp.bugs.interfaces.bug import CreateBugParams
     >>> from lp.bugs.interfaces.bugtask import BugTaskImportance
-    >>> import transaction
+    >>> from lp.registry.interfaces.distribution import IDistributionSet
+    >>> ubuntu = getUtility(IDistributionSet).getByName("ubuntu")
+    >>> ubuntu_mozilla_firefox = ubuntu.getSourcePackage("mozilla-firefox")
     >>> bug_params = CreateBugParams(
     ...     owner=name16,
     ...     title="Some new bug",
@@ -419,46 +327,6 @@
 
     >>> transaction.abort()
 
-Only active milestones relevant to the distribution being searched will
-be shown on the advanced search form.
-
-    >>> form = {
-    ...     'advanced': '1',
-    ...     'search': "Search",
-    ...     'field.distribution': "ubuntu",
-    ...     'field.sourcepackagename': "mozilla-firefox",
-    ...     'field.status': [s.title for s in UNRESOLVED_BUGTASK_STATUSES]}
-
-    >>> packagebugs_search_view = create_view(
-    ...     name16, name="+packagebugs-search", form=form)
-
-    >>> print pretty(packagebugs_search_view.getMilestoneWidgetValues())
-    []
-
-If we add an active milestone to an Ubuntu series we'll see it in the
-package bugs search view.
-
-    >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
-    >>> hoary_series = ubuntu.getSeries('hoary')
-    >>> new_milestone = hoary_series.newMilestone(name='testing')
-
-    >>> packagebugs_search_view = create_view(
-    ...     name16, name="+packagebugs-search", form=form)
-
-    >>> print pretty(packagebugs_search_view.getMilestoneWidgetValues())
-    [{'checked': False,
-      'title': u'Ubuntu testing',
-      'value': '13'}]
-
-If we deactivate our new milestone it'll disappear from the list again.
-
-    >>> new_milestone.active = False
-    >>> packagebugs_search_view = create_view(
-    ...     name16, name="+packagebugs-search", form=form)
-
-    >>> print pretty(packagebugs_search_view.getMilestoneWidgetValues())
-    []
-
 
 Bugs commented on by a Person
 -----------------------------

=== modified file 'lib/lp/bugs/browser/tests/test_person_bugs.py'
--- lib/lp/bugs/browser/tests/test_person_bugs.py	2012-10-02 06:36:44 +0000
+++ lib/lp/bugs/browser/tests/test_person_bugs.py	2014-11-29 03:35:33 +0000
@@ -6,16 +6,8 @@
 __metaclass__ = type
 
 from lp.app.browser.tales import MenuAPI
-from lp.app.errors import UnexpectedFormData
-from lp.bugs.browser import person
-from lp.bugs.interfaces.bugtask import BugTaskStatus
-from lp.testing import (
-    person_logged_in,
-    TestCaseWithFactory,
-    )
-from lp.testing.fakemethod import FakeMethod
+from lp.testing import TestCaseWithFactory
 from lp.testing.layers import DatabaseFunctionalLayer
-from lp.testing.views import create_initialized_view
 
 
 class PersonBugsMenuTestCase(TestCaseWithFactory):
@@ -44,92 +36,3 @@
         expected_links = [
             'assignedbugs', 'relatedbugs', 'softwarebugs', 'subscribedbugs']
         self.assertEqual(expected_links, enabled_links)
-
-
-class TestBugSubscriberPackageBugsSearchListingView(TestCaseWithFactory):
-
-    layer = DatabaseFunctionalLayer
-
-    def setUp(self):
-        super(TestBugSubscriberPackageBugsSearchListingView, self).setUp()
-        self.person = self.factory.makePerson()
-        self.distribution = self.factory.makeDistribution()
-        self.spn = self.factory.makeSourcePackageName()
-        self.dsp = self.distribution.getSourcePackage(self.spn)
-
-    def makeForm(self, package_name, distribution_name):
-        return {
-            'field.sourcepackagename': package_name,
-            'field.distribution': distribution_name,
-            'search': 'Search',
-            }
-
-    def test_current_package_known(self):
-        # current_package contains the distribution source package that
-        # matches the source package name.
-        form = self.makeForm(self.spn.name, self.distribution.name)
-        view = create_initialized_view(
-            self.person, name='+packagebugs-search', form=form)
-        self.assertEqual(self.dsp, view.current_package)
-
-    def test_current_package_missing_distribution(self):
-        # UnexpectedFormData is raised if the distribution is not provided.
-        form = self.makeForm(self.spn.name, '')
-        self.assertRaises(
-            UnexpectedFormData, create_initialized_view, self.person,
-            name='+packagebugs-search', form=form)
-
-    def test_current_package_unknown_distribution(self):
-        # UnexpectedFormData is raised if the distribution is not known.
-        form = self.makeForm(self.spn.name, 'unknown-distribution')
-        self.assertRaises(
-            UnexpectedFormData, create_initialized_view, self.person,
-            name='+packagebugs-search', form=form)
-
-    def test_current_package_missing_sourcepackagename(self):
-        # UnexpectedFormData is raised if the package name is not provided.
-        form = self.makeForm('', self.distribution.name)
-        self.assertRaises(
-            UnexpectedFormData, create_initialized_view, self.person,
-            name='+packagebugs-search', form=form)
-
-    def test_current_package_unknown_sourcepackagename(self):
-        # UnexpectedFormData is raised if the package name is not known.
-        form = self.makeForm('unknown-package', self.distribution.name)
-        self.assertRaises(
-            UnexpectedFormData, create_initialized_view, self.person,
-            name='+packagebugs-search', form=form)
-
-    def test_one_call_of_canonical_url(self):
-        # canonical_url(self.context) is frequently needed to build
-        # URLs pointing to specific search listings in the
-        # +packagebugs page. These URLs are returned, among other
-        # data, by
-        # BugSubscriberPackageBugsSearchListingView.package_bug_counts
-        # This call is relatively expensive, hence a cached value is
-        # used.
-        view = create_initialized_view(self.person, name='+packagebugs')
-        self.factory.makeBug(target=self.dsp, status=BugTaskStatus.INPROGRESS)
-        with person_logged_in(self.person):
-            self.dsp.addSubscription(self.person, subscribed_by=self.person)
-        # Monkey-patch the version of canonical_url used by the registry
-        # person browser module.
-        fake_canonical_url = FakeMethod(result='')
-        real_canonical_url = person.canonical_url
-        person.canonical_url = fake_canonical_url
-        try:
-            view.package_bug_counts
-            self.assertEqual(1, fake_canonical_url.call_count)
-        finally:
-            person.canonical_url = real_canonical_url
-
-    def test_package_bugs_context_description(self):
-        # BugSubscriberPackageBugsSearchListingView.context_description
-        # returns the string $package in $distribution related to $person
-        form = self.makeForm(self.spn.name, self.distribution.name)
-        view = create_initialized_view(
-            self.person, name='+packagebugs-search', form=form)
-        expected = 'in %s in %s related to %s' % (
-            self.spn.name, self.distribution.displayname,
-            self.person.displayname)
-        self.assertEqual(expected, view.context_description)

=== removed file 'lib/lp/bugs/stories/bugs/xx-bug-contacts-reports.txt'
--- lib/lp/bugs/stories/bugs/xx-bug-contacts-reports.txt	2014-11-27 07:48:25 +0000
+++ lib/lp/bugs/stories/bugs/xx-bug-contacts-reports.txt	1970-01-01 00:00:00 +0000
@@ -1,128 +0,0 @@
-The bug supervisor reports present an overview and searchable bug listing
-views for packages for which a user is a bug supervisor.
-
-    >>> anon_browser.open("http://launchpad.dev/~name16/+packagebugs";)
-    >>> print extract_text(find_main_content(anon_browser.contents))
-    Package bugs
-    Foo Bar is subscribed to these packages.
-    ...
-    Totals 1 0 1 0
-    mozilla-firefox in Ubuntu 1 0 1 0
-    pmount in Ubuntu 0 0 0 0
-
-If we add a bug for Foo Bar these numbers will be updated:
-
-    >>> import transaction
-    >>> from zope.component import getUtility
-    >>> from lp.bugs.interfaces.bug import CreateBugParams
-    >>> from lp.registry.interfaces.distribution import IDistributionSet
-    >>> from lp.registry.interfaces.person import IPersonSet
-    >>> from lp.testing import login, logout
-    >>> from lp.services.database.sqlbase import flush_database_updates
-
-    >>> login('foo.bar@xxxxxxxxxxxxx')
-    >>> ubuntu = getUtility(IDistributionSet).getByName("ubuntu")
-    >>> name16 = getUtility(IPersonSet).get(16)
-    >>> pmount = ubuntu.getSourcePackage('pmount')
-    >>> bug_params = CreateBugParams(
-    ...     owner=name16,
-    ...     title="Some new bug",
-    ...     comment="this is a new bug")
-    >>> new_bug = pmount.createBug(bug_params)
-    >>> flush_database_updates()
-    >>> logout()
-
-The numbers displayed will have changed to include the new bug in
-pmount.
-
-    >>> anon_browser.open("http://launchpad.dev/~name16/+packagebugs";)
-    >>> print extract_text(find_main_content(anon_browser.contents))
-    Package bugs
-    Foo Bar is subscribed to these packages.
-    ...
-    Totals 2 0 2 0
-    mozilla-firefox in Ubuntu 1 0 1 0
-    pmount in Ubuntu 1 0 1 0
-
-    >>> transaction.abort()
-
-The overview report presents links to open, critical, unassigned, and in
-progress bugs.
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name16/+packagebugs-search?";
-    ...     "field.distribution=ubuntu&"
-    ...     "field.sourcepackagename=mozilla-firefox&"
-    ...     "field.status=New&field.status=Confirmed&"
-    ...     "field.status=In+Progress&search=Search")
-
-    >>> print anon_browser.title
-    Package bugs : Bugs : Foo Bar
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name16/+packagebugs-search?";
-    ...     "field.distribution=ubuntu&field.importance=Critical&"
-    ...     "field.sourcepackagename=mozilla-firefox&field.status=New&"
-    ...     "field.status=Confirmed&field.status=In+Progress&search=Search")
-
-    >>> print anon_browser.title
-    Package bugs : Bugs : Foo Bar
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name16/+packagebugs-search?";
-    ...     "field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&"
-    ...     "field.status=New&field.status=Confirmed&"
-    ...     "field.status=In+Progress&field.unassigned=on&search=Search")
-
-    >>> print anon_browser.title
-    Package bugs : Bugs : Foo Bar
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name16/+packagebugs-search?";
-    ...     "field.distribution=ubuntu&field.sourcepackagename=mozilla-firefox&"
-    ...     "field.status=In+Progress&search=Search")
-
-    >>> print anon_browser.title
-    Package bugs : Bugs : Foo Bar
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name16/+packagebugs-search?";
-    ...     "field.distribution=debian&field.sourcepackagename=mozilla-firefox&"
-    ...     "field.status=New&field.status=Confirmed&"
-    ...     "field.status=In+Progress&search=Search")
-
-    >>> print anon_browser.title
-    Package bugs : Bugs : Foo Bar
-
-On the bug listing page, there is a searchtext field, for searching the
-title and description of the package's bugs.
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name16/+packagebugs-search?";
-    ...     "field.distribution=debian&field.sourcepackagename=mozilla-firefox&"
-    ...     "field.searchtext=support&search=Search")
-
-    >>> print anon_browser.title
-    Package bugs : Bugs : Foo Bar
-
-
-Error Handling
---------------
-
-The package bugs report must have both a field.distribution and a
-field.sourcepackagename in the URL, otherwise an UnexpectedFormData
-exception will be raised.
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name12/+packagebugs-search?";
-    ...     "advanced=1&field.distribution=ubuntu&field.sourcepackagename=&"
-    ...     "search=Search")
-    Traceback (most recent call last):
-      ..
-    UnexpectedFormData: ...
-
-    >>> anon_browser.open(
-    ...     "http://launchpad.dev/~name12/+packagebugs-search";)
-    Traceback (most recent call last):
-      ..
-    UnexpectedFormData: ...

=== removed file 'lib/lp/bugs/templates/person-packagebugs-search.pt'
--- lib/lp/bugs/templates/person-packagebugs-search.pt	2009-11-27 22:13:22 +0000
+++ lib/lp/bugs/templates/person-packagebugs-search.pt	1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
-<html
-  xmlns="http://www.w3.org/1999/xhtml";
-  xmlns:tal="http://xml.zope.org/namespaces/tal";
-  xmlns:metal="http://xml.zope.org/namespaces/metal";
-  xmlns:i18n="http://xml.zope.org/namespaces/i18n";
-  xml:lang="en"
-  lang="en"
-  dir="ltr"
-  metal:use-macro="view/macro:page/main_side"
-  i18n:domain="launchpad"
->
-  <body>
-
-  <div metal:fill-slot="head_epilogue">
-    <style type="text/css">
-        .section-header {
-          padding-left: 3px;
-          color: #828282;
-          border: 1px solid #cfcfcf;
-          background-color: #E0E0E0;
-          text-align: left;
-        }
-
-        .section {
-          padding-top: 4px;
-          border-style: solid;
-          border-color: #cfcfcf;
-          border-width: 0px 1px 0px 1px;
-        }
-
-        label {
-          font-weight: normal;
-        }
-    </style>
-  </div>
-
-  <metal:side fill-slot="side">
-    <tal:menu replace="structure context/@@+global-actions" />
-  </metal:side>
-
-  <div metal:fill-slot="main">
-      <tal:do_not_show_advanced_form
-        condition="not: view/shouldShowAdvancedForm">
-      <strong>
-        <small tal:content="view/current_package/displayname">
-          mozilla-firefox (Ubuntu)
-        </small>
-      </strong>
-      <div tal:define="batch_navigator view/search">
-        <div tal:define="advanced_search_url view/getBugSubscriberPackageAdvancedSearchURL">
-          <div metal:use-macro="context/@@+bugtarget-macros-search/simple-search-form">
-            <div metal:fill-slot="extra-search-widgets">
-              <tal:widget content="structure view/widgets/distribution/hidden" />
-              <tal:widget content="structure view/widgets/sourcepackagename/hidden" />
-            </div>
-          </div>
-        </div>
-        <br />
-        <tal:buglisting content="structure batch_navigator/@@+table-view" />
-      </div>
-      </tal:do_not_show_advanced_form>
-
-      <tal:show_advanced condition="view/shouldShowAdvancedForm">
-        <metal:advanced_form
-          use-macro="context/@@+bugtask-macros-tableview/advanced_search_form" />
-      </tal:show_advanced>
-  </div>
-</body>
-</html>


References