launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03957
[Merge] lp:~allenap/launchpad/isDerivedSeries-method into lp:launchpad
Gavin Panella has proposed merging lp:~allenap/launchpad/isDerivedSeries-method into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~allenap/launchpad/isDerivedSeries-method/+merge/64597
Change the DistroSeries.is_derived_series property into a method, because it issues at least one query.
--
https://code.launchpad.net/~allenap/launchpad/isDerivedSeries-method/+merge/64597
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/isDerivedSeries-method into lp:launchpad.
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2011-06-14 08:25:41 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2011-06-14 19:46:34 +0000
@@ -236,9 +236,6 @@
Choice(
title=_("Status"), required=True,
vocabulary=SeriesStatus))
- is_derived_series = Bool(
- title=u'Is this series a derived series?', readonly=True,
- description=(u"Whether or not this series is a derived series."))
datereleased = exported(
Datetime(title=_("Date released")))
previous_series = exported(
@@ -885,6 +882,12 @@
child's version is higher than the parent's version.
"""
+ def isDerivedSeries():
+ """Is this series a derived series?
+
+ A derived series has one or more parent series.
+ """
+
def isInitializing():
"""Is this series initializing?"""
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2011-06-14 08:25:41 +0000
+++ lib/lp/registry/model/distroseries.py 2011-06-14 19:46:34 +0000
@@ -796,11 +796,6 @@
self.distribution.name.capitalize(), self.name.capitalize())
@property
- def is_derived_series(self):
- """See `IDistroSeries`."""
- return not self.getParentSeries() == []
-
- @property
def bugtargetname(self):
"""See IBugTarget."""
# XXX mpt 2007-07-10 bugs 113258, 113262:
@@ -1973,7 +1968,7 @@
overlay_pockets=(),
overlay_components=()):
"""See `IDistroSeries`."""
- if self.is_derived_series:
+ if self.isDerivedSeries():
raise DerivationError(
"DistroSeries %s already has parent series." % self.name)
initialize_series = InitializeDistroSeries(self, parents)
@@ -2035,6 +2030,10 @@
status=status,
child_version_higher=child_version_higher)
+ def isDerivedSeries(self):
+ """See `IDistroSeries`."""
+ return not self.getParentSeries() == []
+
def isInitializing(self):
"""See `IDistroSeries`."""
job_source = getUtility(IInitializeDistroSeriesJobSource)
=== modified file 'lib/lp/registry/templates/distroseries-index.pt'
--- lib/lp/registry/templates/distroseries-index.pt 2011-06-14 08:25:41 +0000
+++ lib/lp/registry/templates/distroseries-index.pt 2011-06-14 19:46:34 +0000
@@ -68,7 +68,7 @@
<tal:derivation
tal:condition="request/features/soyuz.derived_series_ui.enabled">
<div class="yui-u"
- tal:condition="python: context.is_derived_series or
+ tal:condition="python: context.isDerivedSeries() or
context.isInitializing()">
<div tal:replace="structure context/@@+portlet-derivation" />
</div>
=== modified file 'lib/lp/registry/templates/distroseries-portlet-derivation.pt'
--- lib/lp/registry/templates/distroseries-portlet-derivation.pt 2011-06-10 15:58:51 +0000
+++ lib/lp/registry/templates/distroseries-portlet-derivation.pt 2011-06-14 19:46:34 +0000
@@ -4,8 +4,13 @@
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
id="series-derivation" class="portlet"
tal:define="overview_menu context/menu:overview">
+<<<<<<< TREE
<tal:is_derived condition="context/is_derived_series">
<tal:is_initialized condition="not: context/isInitializing">
+=======
+ <tal:is_derived condition="context/isDerivedSeries">
+ <tal:is_initialised condition="not: context/isInitializing">
+>>>>>>> MERGE-SOURCE
<tal:one_parent condition="view/has_unique_parent">
<h2>Derived from <tal:name replace="view/unique_parent/displayname"/></h2>
</tal:one_parent>
=== modified file 'lib/lp/registry/tests/test_distroseries.py'
--- lib/lp/registry/tests/test_distroseries.py 2011-06-10 15:58:51 +0000
+++ lib/lp/registry/tests/test_distroseries.py 2011-06-14 19:46:34 +0000
@@ -222,6 +222,14 @@
self.assertEquals(registrant, distroseries.registrant)
self.assertNotEqual(distroseries.registrant, distroseries.owner)
+ def test_isDerivedSeries(self):
+ # The series method isInitializing() returns True only if the series
+ # has one or more parent series.
+ distroseries = self.factory.makeDistroSeries()
+ self.assertFalse(distroseries.isDerivedSeries())
+ self.factory.makeDistroSeriesParent(derived_series=distroseries)
+ self.assertTrue(distroseries.isDerivedSeries())
+
def test_isInitializing(self):
# The series method isInitializing() returns True only if there is an
# initialization job with a pending status attached to this series.
=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py 2011-06-09 10:52:17 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py 2011-06-14 19:46:34 +0000
@@ -92,8 +92,13 @@
self._store = IMasterStore(DistroSeries)
def check(self):
+<<<<<<< TREE
if self.distroseries.is_derived_series:
raise InitializationError(
+=======
+ if self.distroseries.isDerivedSeries():
+ raise InitialisationError(
+>>>>>>> MERGE-SOURCE
("DistroSeries {child.name} has already been initialized"
".").format(
child=self.distroseries))