launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04443
[Merge] lp:~wgrant/launchpad/iseriesbugtarget into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/iseriesbugtarget into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/iseriesbugtarget/+merge/69951
Add ISeriesBugTarget to allow easy detection of series bug targets, including a bugtarget_parent attribute to link to the non-series parent IBugTarget.
Better names for the attribute welcome. "pillar" is nice, but doesn't cover DistributionSourcePackage.
Only shouldIndentTask uses it for now, but followup branches will use it more.
--
https://code.launchpad.net/~wgrant/launchpad/iseriesbugtarget/+merge/69951
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/iseriesbugtarget into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2011-07-28 17:34:34 +0000
+++ lib/lp/bugs/browser/bugtask.py 2011-08-01 05:41:26 +0000
@@ -220,6 +220,7 @@
BugNominationStatus,
IBugNominationSet,
)
+from lp.bugs.interfaces.bugtarget import ISeriesBugTarget
from lp.bugs.interfaces.bugtask import (
BugBlueprintSearch,
BugBranchSearch,
@@ -3399,9 +3400,7 @@
Returns True or False.
"""
- if self.context.productseries or self.context.distroseries:
- return True
- return False
+ return ISeriesBugTarget.providedBy(self.context.target)
def taskLink(self):
"""Return the proper link to the bugtask whether it's editable."""
=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
--- lib/lp/bugs/interfaces/bugtarget.py 2011-06-20 01:13:36 +0000
+++ lib/lp/bugs/interfaces/bugtarget.py 2011-08-01 05:41:26 +0000
@@ -18,6 +18,7 @@
'IOfficialBugTagTarget',
'IOfficialBugTagTargetPublic',
'IOfficialBugTagTargetRestricted',
+ 'ISeriesBugTarget',
]
@@ -455,3 +456,10 @@
schema=IOfficialBugTagTarget,
description=
u'The distribution or product having this official bug tag.')
+
+
+class ISeriesBugTarget(Interface):
+ """An `IBugTarget` which is a series."""
+
+ bugtarget_parent = Attribute(
+ "Non-series parent of this series bug target.")
=== modified file 'lib/lp/bugs/tests/test_bugtarget2.py'
--- lib/lp/bugs/tests/test_bugtarget2.py 2010-11-30 15:01:41 +0000
+++ lib/lp/bugs/tests/test_bugtarget2.py 2011-08-01 05:41:26 +0000
@@ -8,6 +8,7 @@
from zope.security.interfaces import ForbiddenAttribute
from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.bugs.interfaces.bugtarget import ISeriesBugTarget
from lp.testing import (
person_logged_in,
TestCaseWithFactory,
@@ -51,6 +52,11 @@
super(TestDistroSeries, self).setUp()
self.bugtarget = self.factory.makeDistroSeries()
+ def test_bugtarget_parent(self):
+ self.assertTrue(ISeriesBugTarget.providedBy(self.bugtarget))
+ self.assertEqual(
+ self.bugtarget.distribution, self.bugtarget.bugtarget_parent)
+
class TestProjectGroup(BugTargetBugFilingDuplicateSearchAlwaysOn,
TestCaseWithFactory):
@@ -119,7 +125,8 @@
# If enable_bugfiling_duplicate_search is changed for the parent
# object, it is changed for the bug traget too.
with person_logged_in(self.bug_supervisor):
- self.bugtarget_parent.enable_bugfiling_duplicate_search = False
+ parent = self.bugtarget.bugtarget_parent
+ parent.enable_bugfiling_duplicate_search = False
self.assertFalse(self.bugtarget.enable_bugfiling_duplicate_search)
@@ -132,10 +139,14 @@
def setUp(self):
super(TestProductSeries, self).setUp()
self.bug_supervisor = self.factory.makePerson()
- self.bugtarget_parent = self.factory.makeProduct(
- bug_supervisor=self.bug_supervisor)
self.bugtarget = self.factory.makeProductSeries(
- product=self.bugtarget_parent)
+ product=self.factory.makeProduct(
+ bug_supervisor=self.bug_supervisor))
+
+ def test_bugtarget_parent(self):
+ self.assertTrue(ISeriesBugTarget.providedBy(self.bugtarget))
+ self.assertEqual(
+ self.bugtarget.product, self.bugtarget.bugtarget_parent)
class TestSourcePackage(BugTargetBugFilingDuplicateSearchInherited,
@@ -153,4 +164,9 @@
distribution=distribution)
self.bugtarget = self.factory.makeSourcePackage(
distroseries=distroseries)
- self.bugtarget_parent = self.bugtarget.distribution_sourcepackage
+
+ def test_bugtarget_parent(self):
+ self.assertTrue(ISeriesBugTarget.providedBy(self.bugtarget))
+ self.assertEqual(
+ self.bugtarget.distribution_sourcepackage,
+ self.bugtarget.bugtarget_parent)
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2011-07-25 18:50:46 +0000
+++ lib/lp/registry/configure.zcml 2011-08-01 05:41:26 +0000
@@ -205,6 +205,8 @@
<allow
interface="lp.bugs.interfaces.bugtarget.IHasBugHeat"/>
<allow
+ interface="lp.bugs.interfaces.bugtarget.ISeriesBugTarget"/>
+ <allow
interface="lp.soyuz.interfaces.queue.IHasQueueItems"/>
<allow
interface="lp.soyuz.interfaces.publishing.ICanPublishPackages"/>
@@ -1412,6 +1414,8 @@
<allow interface="lp.bugs.interfaces.bugsummary.IBugSummaryDimension"/>
<allow
interface="lp.bugs.interfaces.bugtarget.IHasBugHeat"/>
+ <allow
+ interface="lp.bugs.interfaces.bugtarget.ISeriesBugTarget"/>
<require
permission="launchpad.Edit"
set_schema="lp.app.interfaces.launchpad.IServiceUsage"/>
@@ -1615,6 +1619,8 @@
<allow
interface="lp.bugs.interfaces.bugtarget.IHasBugHeat"/>
<allow
+ interface="lp.bugs.interfaces.bugtarget.ISeriesBugTarget"/>
+ <allow
interface="lp.soyuz.interfaces.buildrecords.IHasBuildRecords"/>
<require
permission="launchpad.Edit"
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2011-07-14 18:28:37 +0000
+++ lib/lp/registry/model/distroseries.py 2011-08-01 05:41:26 +0000
@@ -81,7 +81,10 @@
Specification,
)
from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
-from lp.bugs.interfaces.bugtarget import IHasBugHeat
+from lp.bugs.interfaces.bugtarget import (
+ IHasBugHeat,
+ ISeriesBugTarget,
+ )
from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
from lp.bugs.model.bug import (
get_bug_tags,
@@ -212,7 +215,7 @@
"""A particular series of a distribution."""
implements(
ICanPublishPackages, IBugSummaryDimension, IDistroSeries, IHasBugHeat,
- IHasBuildRecords, IHasQueueItems, IServiceUsage)
+ IHasBuildRecords, IHasQueueItems, IServiceUsage, ISeriesBugTarget)
_table = 'DistroSeries'
_defaultOrder = ['distribution', 'version']
@@ -804,6 +807,11 @@
return self.fullseriesname
@property
+ def bugtarget_parent(self):
+ """See `ISeriesBugTarget`."""
+ return self.parent
+
+ @property
def max_bug_heat(self):
"""See `IHasBugs`."""
return self.distribution.max_bug_heat
=== modified file 'lib/lp/registry/model/productseries.py'
--- lib/lp/registry/model/productseries.py 2011-06-21 00:04:12 +0000
+++ lib/lp/registry/model/productseries.py 2011-08-01 05:41:26 +0000
@@ -63,7 +63,10 @@
Specification,
)
from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
-from lp.bugs.interfaces.bugtarget import IHasBugHeat
+from lp.bugs.interfaces.bugtarget import (
+ IHasBugHeat,
+ ISeriesBugTarget,
+ )
from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
from lp.bugs.model.bug import (
get_bug_tags,
@@ -128,7 +131,9 @@
HasTranslationImportsMixin, HasTranslationTemplatesMixin,
StructuralSubscriptionTargetMixin, SeriesMixin):
"""A series of product releases."""
- implements(IBugSummaryDimension, IHasBugHeat, IProductSeries, IServiceUsage)
+ implements(
+ IBugSummaryDimension, IHasBugHeat, IProductSeries, IServiceUsage,
+ ISeriesBugTarget)
_table = 'ProductSeries'
@@ -249,6 +254,11 @@
return "%s/%s" % (self.product.name, self.name)
@property
+ def bugtarget_parent(self):
+ """See `ISeriesBugTarget`."""
+ return self.parent
+
+ @property
def max_bug_heat(self):
"""See `IHasBugs`."""
return self.product.max_bug_heat
=== modified file 'lib/lp/registry/model/sourcepackage.py'
--- lib/lp/registry/model/sourcepackage.py 2011-07-08 05:18:12 +0000
+++ lib/lp/registry/model/sourcepackage.py 2011-08-01 05:41:26 +0000
@@ -38,7 +38,10 @@
QuestionTargetSearch,
)
from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
-from lp.bugs.interfaces.bugtarget import IHasBugHeat
+from lp.bugs.interfaces.bugtarget import (
+ IHasBugHeat,
+ ISeriesBugTarget,
+ )
from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
from lp.bugs.model.bug import get_bug_tags_open_count
from lp.bugs.model.bugtarget import (
@@ -197,7 +200,8 @@
"""
implements(
- IBugSummaryDimension, ISourcePackage, IHasBugHeat, IHasBuildRecords)
+ IBugSummaryDimension, ISourcePackage, IHasBugHeat, IHasBuildRecords,
+ ISeriesBugTarget)
classProvides(ISourcePackageFactory)
@@ -326,6 +330,11 @@
return "%s (%s)" % (self.name, self.distroseries.fullseriesname)
@property
+ def bugtarget_parent(self):
+ """See `ISeriesBugTarget`."""
+ return self.distribution_sourcepackage
+
+ @property
def title(self):
"""See `ISourcePackage`."""
return smartquote('"%s" source package in %s') % (