launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00074
[Merge] lp:~sinzui/launchpad/delete-unused-0 into lp:launchpad/devel
Curtis Hovey has proposed merging lp:~sinzui/launchpad/delete-unused-0 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This is my branch to delete obsolete StructuralObjectPresentation.
lp:~sinzui/launchpad/delete-unused-0
Diff size: 296
Launchpad bug:
https://bugs.launchpad.net/bugs/241631
Test command: ./bin/test -vv -t bugtask-management/.*
Pre-implementation: no one
Target release: 10.08
Delete obsolete code and files
------------------------------
Bug #241631 [StructuralHeaderPresentation and StructuralObjectPresentation
are obsolete]
As of 2008-2.0-1-header, StructuralHeaderPresentation and
StructuralObjectPresentation are no longer used. Well this is not
true, BugTaskView and BugTaskEditView used the objects to create
page titles.
Rules
-----
* Inline the SOP title logic into BugTaskView.
* Remove the class and the obsolete pagetitle helpers.
* ADDENDUM: Make sane BugTaskStatusView and BugTaskEditStatusView
page_titles. They inherit the rules from pagetitles to make
redundant and confusing titles eg, this bug:
Bug #241631 in Launchpad Foundations: “StructuralHeaderPresentation
and StructuralObjectPresentation are obsolete” : Bug #241631 :
Bugs : Launchpad Foundations
QA
--
* Visit https://bugs.edge.launchpad.net/launchpad-foundations/+bug/241631
And verify its page title is
Bug #241631 in Launchpad Foundations: “StructuralHeaderPresentation
and StructuralObjectPresentation are obsolete”
* Visit https://bugs.edge.launchpad.net/launchpad-foundations/+bug/241631/+editstatus
Verify it is a standard lp page title/bread crumb:
Edit status : Bug #241631 : Bugs : Launchpad Foundations
Lint
----
Linting changed files:
lib/canonical/launchpad/pagetitles.py
lib/canonical/launchpad/browser/launchpad.py
lib/canonical/launchpad/interfaces/launchpad.py
lib/lp/bugs/configure.zcml
lib/lp/bugs/browser/bugtask.py
lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt
lib/lp/bugs/stories/bugtask-management/xx-view-editable-bug-task.txt
^ There are a number of issues reported. I do not think I should fix
pagetitles because it is obsolete. I can fix the other style issues
reported.
Test
----
* lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt
* Updated the test...the ellipsises were hiding the insane title.
* lib/lp/bugs/stories/bugtask-management/xx-view-editable-bug-task.txt
* Updated the test...the ellipsises were hiding the insane title.
Implementation
--------------
* lib/canonical/launchpad/pagetitles.py
* Removed the obsolete pagetitles by inlining the logic into the view.
* lib/canonical/launchpad/browser/launchpad.py
* Removed the obsolete classes.
* lib/canonical/launchpad/interfaces/launchpad.py
* Removed the obsolete interfaces.
* lib/lp/bugs/configure.zcml
* Unregistered the class
* lib/lp/bugs/browser/bugtask.py
* Inlined the title rules
* Fixed the insane status and editstatus rules
* Removed BugTaskSOP.
--
https://code.launchpad.net/~sinzui/launchpad/delete-unused-0/+merge/29739
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/delete-unused-0 into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
--- lib/canonical/launchpad/browser/launchpad.py 2010-05-11 17:43:20 +0000
+++ lib/canonical/launchpad/browser/launchpad.py 2010-07-12 19:36:06 +0000
@@ -21,8 +21,6 @@
'NavigationMenuTabs',
'RDFIndexView',
'SoftTimeoutView',
- 'StructuralHeaderPresentation',
- 'StructuralObjectPresentation',
'get_launchpad_views',
]
@@ -55,8 +53,7 @@
from canonical.launchpad.interfaces.account import AccountStatus
from canonical.launchpad.interfaces.launchpad import (
IAppFrontPageSearchForm, IBazaarApplication, ILaunchpadCelebrities,
- IRosettaApplication, IStructuralHeaderPresentation,
- IStructuralObjectPresentation)
+ IRosettaApplication)
from canonical.launchpad.interfaces.launchpadstatistic import (
ILaunchpadStatisticSet)
from canonical.launchpad.interfaces.logintoken import ILoginTokenSet
@@ -840,39 +837,6 @@
return self, ()
-class StructuralHeaderPresentation:
- """Base class for StructuralHeaderPresentation adapters."""
-
- implements(IStructuralHeaderPresentation)
-
- def __init__(self, context):
- self.context = context
-
- def getIntroHeading(self):
- return None
-
- def getMainHeading(self):
- raise NotImplementedError()
-
-
-class StructuralObjectPresentation(StructuralHeaderPresentation):
- """Base class for StructuralObjectPresentation adapters."""
-
- implements(IStructuralObjectPresentation)
-
- def listChildren(self, num):
- return []
-
- def countChildren(self):
- raise NotImplementedError()
-
- def listAltChildren(self, num):
- return None
-
- def countAltChildren(self):
- raise NotImplementedError()
-
-
class Button:
def __init__(self, **kw):
=== modified file 'lib/canonical/launchpad/interfaces/launchpad.py'
--- lib/canonical/launchpad/interfaces/launchpad.py 2010-07-02 12:10:21 +0000
+++ lib/canonical/launchpad/interfaces/launchpad.py 2010-07-12 19:36:06 +0000
@@ -61,8 +61,6 @@
'IPrivacy',
'IReadZODBAnnotation',
'IRosettaApplication',
- 'IStructuralHeaderPresentation',
- 'IStructuralObjectPresentation',
'IWebServiceApplication',
'IWriteZODBAnnotation',
'IZODBAnnotation',
@@ -485,38 +483,6 @@
datecreated = Attribute("The date on which I was created.")
-class IStructuralHeaderPresentation(Interface):
- """Adapter for common aspects of a structural object's presentation."""
-
- def getIntroHeading():
- """Any heading introduction needed (e.g. "Ubuntu source package:")."""
-
- def getMainHeading():
- """can be None"""
-
-
-class IStructuralObjectPresentation(IStructuralHeaderPresentation):
- """Adapter for less common parts of a structural object's presentation."""
-
- def listChildren(num):
- """List up to num children. Return empty string for none of these"""
-
- def countChildren():
- """Return the total number of children."""
-
- def listAltChildren(num):
- """List up to num alternative children.
-
- Return None if alt children are not supported.
- """
-
- def countAltChildren():
- """Return the total number of alt children.
-
- Will be called only if listAltChildren returns something.
- """
-
-
class IAppFrontPageSearchForm(Interface):
"""Schema for the app-specific front page search question forms."""
=== modified file 'lib/canonical/launchpad/pagetitles.py'
--- lib/canonical/launchpad/pagetitles.py 2010-06-02 16:40:02 +0000
+++ lib/canonical/launchpad/pagetitles.py 2010-07-12 19:36:06 +0000
@@ -46,20 +46,13 @@
from zope.component import getUtility
from canonical.launchpad.interfaces import (
- ILaunchBag, IMaloneApplication, IPerson, IStructuralObjectPresentation)
+ ILaunchBag, IMaloneApplication, IPerson)
from canonical.lazr.utils import smartquote
DEFAULT_LAUNCHPAD_TITLE = 'Launchpad'
# Helpers.
-class BugTaskPageTitle:
- """Return the page title for a BugTask."""
- def __call__(self, context, view):
- return smartquote('%s: "%s"') % (
- IStructuralObjectPresentation(context).getMainHeading(),
- context.bug.title)
-
class SubstitutionHelper:
"""An abstract class for substituting values into formatted strings."""
@@ -235,15 +228,11 @@
bugtask_confirm_bugtracker_creation = LaunchbagBugID(
'Bug #%d - Record as affecting another software')
-bugtask_edit = BugTaskPageTitle()
-
bugtask_requestfix = LaunchbagBugID(
'Bug #%d - Record as affecting another distribution/package')
bugtask_requestfix_upstream = LaunchbagBugID('Bug #%d - Confirm project')
-bugtask_view = BugTaskPageTitle()
-
# bugtask_macros_buglisting contains only macros
# bugtasks_index is a redirect
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-07-08 13:10:41 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-07-12 19:36:06 +0000
@@ -25,7 +25,6 @@
'BugTaskPortletView',
'BugTaskPrivacyAdapter',
'BugTaskRemoveQuestionView',
- 'BugTaskSOP',
'BugTaskSearchListingView',
'BugTaskSetNavigation',
'BugTaskStatusView',
@@ -123,7 +122,7 @@
IDistributionSourcePackage)
from lp.registry.interfaces.distroseries import IDistroSeries
from canonical.launchpad.interfaces.launchpad import (
- ILaunchpadCelebrities, IStructuralObjectPresentation)
+ ILaunchpadCelebrities)
from lp.registry.interfaces.person import IPerson, IPersonSet
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.productseries import IProductSeries
@@ -144,7 +143,6 @@
from canonical.launchpad.browser.feeds import (
BugTargetLatestBugsFeedLink, FeedsMixin)
from lp.registry.browser.mentoringoffer import CanBeMentoredView
-from canonical.launchpad.browser.launchpad import StructuralObjectPresentation
from canonical.launchpad.webapp.authorization import check_permission
from canonical.launchpad.webapp.batching import TableBatchNavigator
@@ -543,9 +541,14 @@
@property
def page_title(self):
- return smartquote('%s: "%s"') % (
- IStructuralObjectPresentation(self.context).getMainHeading(),
- self.context.bug.title)
+ bugtask = self.context
+ if INullBugTask.providedBy(bugtask):
+ heading = 'Bug #%s is not in %s' % (
+ bugtask.bug.id, bugtask.bugtargetdisplayname)
+ else:
+ heading = 'Bug #%s in %s' % (
+ bugtask.bug.id, bugtask.bugtargetdisplayname)
+ return smartquote('%s: "%s"') % (heading, self.context.bug.title)
def initialize(self):
"""Set up the needed widgets."""
@@ -1266,6 +1269,7 @@
if self.user_is_subscribed is None:
self.user_is_subscribed = self.context.bug.isSubscribed(self.user)
+ page_title = 'Edit status'
@cachedproperty
def field_names(self):
@@ -1729,6 +1733,8 @@
class BugTaskStatusView(LaunchpadView):
"""Viewing the status of a bug task."""
+ page_title = 'View status'
+
def initialize(self):
"""Set up the appropriate widgets.
@@ -3602,35 +3608,6 @@
return self.context.bug.private
-# XXX mars 2008-08-25 bug=261188
-# This whole class hierarchy should be replaced with something more
-# specific, ie. a class that generates BugTask page titles.
-class BugTaskSOP(StructuralObjectPresentation):
- """Provides the structural heading for `IBugTask`."""
-
- def getIntroHeading(self):
- """Return None."""
- return None
-
- def getMainHeading(self):
- """Return the heading using the BugTask."""
- bugtask = self.context
- if INullBugTask.providedBy(bugtask):
- return 'Bug #%s is not in %s' % (
- bugtask.bug.id, bugtask.bugtargetdisplayname)
- else:
- return 'Bug #%s in %s' % (
- bugtask.bug.id, bugtask.bugtargetdisplayname)
-
- def listChildren(self, num):
- """Return an empty list."""
- return []
-
- def listAltChildren(self, num):
- """Return None."""
- return None
-
-
class BugTaskCreateQuestionView(LaunchpadFormView):
"""View for creating a question from a bug."""
schema = ICreateQuestionFromBugTaskForm
=== modified file 'lib/lp/bugs/configure.zcml'
--- lib/lp/bugs/configure.zcml 2010-07-08 13:10:41 +0000
+++ lib/lp/bugs/configure.zcml 2010-07-12 19:36:06 +0000
@@ -256,11 +256,6 @@
retractMentoring"/>
</class>
<adapter
- provides="canonical.launchpad.interfaces.IStructuralObjectPresentation"
- for="lp.bugs.interfaces.bugtask.IBugTask"
- factory="lp.bugs.browser.bugtask.BugTaskSOP"
- permission="zope.Public"/>
- <adapter
provides="canonical.lazr.interfaces.IObjectPrivacy"
for="lp.bugs.interfaces.bugtask.IBugTask"
factory="lp.bugs.browser.bugtask.BugTaskPrivacyAdapter"
=== modified file 'lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt'
--- lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt 2009-11-09 13:04:35 +0000
+++ lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt 2010-07-12 19:36:06 +0000
@@ -37,7 +37,7 @@
>>> admin_browser.getLink('New').click()
>>> print extract_text(admin_browser.contents)
-Bug #1 in Mozilla Firefox...
+Edit status...
...
Affecting: Mozilla Firefox
Filed here by: Sample Person
=== modified file 'lib/lp/bugs/stories/bugtask-management/xx-view-editable-bug-task.txt'
--- lib/lp/bugs/stories/bugtask-management/xx-view-editable-bug-task.txt 2009-09-18 15:24:30 +0000
+++ lib/lp/bugs/stories/bugtask-management/xx-view-editable-bug-task.txt 2010-07-12 19:36:06 +0000
@@ -36,4 +36,4 @@
>>> browser = setupBrowser(auth="Basic test@xxxxxxxxxxxxx:test")
>>> browser.open("http://launchpad.dev/firefox/+bug/6/+editstatus")
>>> print browser.title
- Bug #6 in Mozilla Firefox...
+ Edit status ...