← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/launchpad/derives-from-portlet-bug-793547 into lp:launchpad/db-devel

 

Gavin Panella has proposed merging lp:~allenap/launchpad/derives-from-portlet-bug-793547 into lp:launchpad/db-devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #793547 in Launchpad itself: "The "Derives from:" portlet should be updated to use DSP."
  https://bugs.launchpad.net/launchpad/+bug/793547

For more details, see:
https://code.launchpad.net/~allenap/launchpad/derives-from-portlet-bug-793547/+merge/63704

This changes the "Series information" portlet on DistroSeries:+index
to show derivation information when the derivation UI flag is enabled.

It also fixes a bug where "No derived series" was being shown when
there were derived series, and not being shown where there were none.

-- 
https://code.launchpad.net/~allenap/launchpad/derives-from-portlet-bug-793547/+merge/63704
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/derives-from-portlet-bug-793547 into lp:launchpad/db-devel.
=== modified file 'lib/lp/registry/stories/distroseries/xx-distroseries-index.txt'
--- lib/lp/registry/stories/distroseries/xx-distroseries-index.txt	2011-05-24 10:08:33 +0000
+++ lib/lp/registry/stories/distroseries/xx-distroseries-index.txt	2011-06-07 13:48:36 +0000
@@ -51,13 +51,52 @@
     Release manager: None
     Status: Current Stable Release
     Derives from: Warty (4.10) is not derived from another series.
-    Derived series:
+    Derived series: No derived series.
     Source packages: 3
     Binary packages: 4
 
 On series that have no source or binary packages, the portlet will
 change its text slightly to annouce this:
 
+    >>> anon_browser.open('http://launchpad.dev/debian/sarge')
+    >>> print extract_text(
+    ...     find_portlet(anon_browser.contents, 'Series information'))
+    Series information
+    Distribution: Debian
+    Series: Sarge (3.1)
+    Project drivers: Jeff Waugh, Mark Shuttleworth
+    Release manager: Jeff Waugh
+    Status: Pre-release Freeze
+    Derives from: Woody (3.0)
+    Source packages: No sources imported or published.
+    Binary packages: No binaries imported or published.
+
+The series' derivation parents - rather than the previous series - are
+shown when derivation is enabled, as are the series derived from this
+series:
+
+    >>> from lp.registry.interfaces.distribution import IDistributionSet
+    >>> from lp.testing import celebrity_logged_in
+    >>> from zope.component import getUtility
+
+    >>> with celebrity_logged_in("admin"):
+    ...     debian = getUtility(IDistributionSet).getByName(u"debian")
+    ...     sarge = debian.getSeries(u"sarge")
+    ...     parents = [
+    ...         factory.makeDistroSeries(name=u"dobby"),
+    ...         factory.makeDistroSeries(name=u"knobby")]
+    ...     distro_series_parents = [
+    ...         factory.makeDistroSeriesParent(
+    ...             derived_series=sarge, parent_series=parent)
+    ...         for parent in parents]
+    ...     children = [
+    ...         factory.makeDistroSeries(name=u"bobby"),
+    ...         factory.makeDistroSeries(name=u"tables")]
+    ...     distro_series_children = [
+    ...         factory.makeDistroSeriesParent(
+    ...             derived_series=child, parent_series=sarge)
+    ...         for child in children]
+
     >>> with derivation_enabled:
     ...     anon_browser.open('http://launchpad.dev/debian/sarge')
     >>> print extract_text(
@@ -68,8 +107,8 @@
     Project drivers: Jeff Waugh, Mark Shuttleworth
     Release manager: Jeff Waugh
     Status: Pre-release Freeze
-    Derives from: Woody (3.0)
-    Derived series:
+    Derives from: Dobby (...), Knobby (...)
+    Derived series: Bobby (...), Tables (...)
     Source packages: No sources imported or published.
     Binary packages: No binaries imported or published.
 

=== modified file 'lib/lp/registry/templates/distroseries-details.pt'
--- lib/lp/registry/templates/distroseries-details.pt	2011-05-24 10:08:33 +0000
+++ lib/lp/registry/templates/distroseries-details.pt	2011-06-07 13:48:36 +0000
@@ -46,6 +46,9 @@
       </dd>
     </dl>
 
+    <tal:derivation-not-enabled
+        tal:condition="not:request/features/soyuz.derived_series_ui.enabled">
+
     <dl>
       <dt>Derives from:</dt>
       <dd>
@@ -60,8 +63,27 @@
       </dd>
     </dl>
 
-    <dl tal:condition="request/features/soyuz.derived_series_ui.enabled"
-        tal:define="all_child_series context/getDerivedSeries">
+    </tal:derivation-not-enabled>
+
+    <tal:derivation-enabled
+        tal:condition="request/features/soyuz.derived_series_ui.enabled">
+
+    <dl tal:define="parents context/getParentSeries">
+      <dt>Derives from:</dt>
+      <dd tal:condition="parents">
+        <tal:parents repeat="parent parents">
+          <a tal:attributes="href parent/fmt:url"
+             tal:content="parent/named_version">
+          </a><tal:comma condition="not:repeat/parent/end">, </tal:comma>
+        </tal:parents>
+      </dd>
+      <dd tal:condition="not:parents">
+        <tal:name replace="context/named_version"/> is not derived from
+        another series.
+      </dd>
+    </dl>
+
+    <dl tal:define="all_child_series context/getDerivedSeries">
       <dt>Derived series:</dt>
       <dd>
         <tal:per_child_series repeat="child_series all_child_series">
@@ -70,12 +92,14 @@
             tal:content="child_series/named_version" /><tal:comma
             condition="not: repeat/child_series/end">,</tal:comma>
         </tal:per_child_series>
-       <tal:none condition="all_child_series">
+        <tal:none condition="not:all_child_series">
           No derived series.
         </tal:none>
       </dd>
     </dl>
 
+    </tal:derivation-enabled>
+
     <dl tal:define="sourcecount context/sourcecount">
       <dt>Source packages:</dt>
       <dd


Follow ups