← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/desc-header-827893 into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/desc-header-827893 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #827893 in Launchpad itself: "'Binary Package Descriptions' heading should be removed if there are no binaries to show"
  https://bugs.launchpad.net/launchpad/+bug/827893

For more details, see:
https://code.launchpad.net/~rvb/launchpad/desc-header-827893/+merge/71842

This branch removes the "Binary descriptions:" slot if no binary descriptions are to be displayed.
It also improves the UI of the rows on the diff pages as a drive-by fix.

= Test =

./bin/test -vvc test_distroseriesdifference_views test_binary_summaries_none_no_display

= Q/A =

Open any row on this page: https://dogfood.launchpad.net/ubuntu/oneiric/+missingpackages. The "Binary descriptions:" slot should not be displayed.
-- 
https://code.launchpad.net/~rvb/launchpad/desc-header-827893/+merge/71842
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/desc-header-827893 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/tests/test_distroseriesdifference_views.py'
--- lib/lp/registry/browser/tests/test_distroseriesdifference_views.py	2011-06-22 10:48:40 +0000
+++ lib/lp/registry/browser/tests/test_distroseriesdifference_views.py	2011-08-17 10:58:31 +0000
@@ -146,6 +146,26 @@
         self.assertIs(None, ds_diff.source_pub)
         self.assertIs(None, view.binary_summaries)
 
+    def test_binary_summaries_none_no_display(self):
+        # If, for a difference, binary_summaries=None, then the slot to
+        # display binary summaries is not present.
+        ds_diff = self.factory.makeDistroSeriesDifference(
+            difference_type=(
+                DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES))
+        with celebrity_logged_in('admin'):
+            ds_diff.parent_source_pub.status = PackagePublishingStatus.DELETED
+        ds_diff.update()
+
+        view = create_initialized_view(ds_diff, '+listing-distroseries-extra')
+
+        binary_description_matcher = soupmatchers.HTMLContains(
+            soupmatchers.Tag(
+                'Binary descriptions header', 'dt',
+                text=re.compile(
+                    '\s*Binary descriptions:\s*')))
+
+        self.assertThat(view(), Not(binary_description_matcher))
+
     def test_show_edit_options_non_ajax(self):
         # Blacklist options and "Add comment" are not shown for non-ajax
         # requests.
@@ -206,7 +226,7 @@
             'foo', ['0.1-1derived1', '0.1-1'])
         parent_changelog_lfa = self.factory.makeChangelog(
             'foo', ['0.1-2', '0.1-1'])
-        transaction.commit() # Yay, librarian.
+        transaction.commit()  # Yay, librarian.
         ds_diff = self.factory.makeDistroSeriesDifference(versions={
             'derived': '0.1-1derived1',
             'parent': '0.1-2',
@@ -228,7 +248,7 @@
         changelog_lfa = self.factory.makeChangelog('foo', ['0.30-1'])
         parent_changelog_lfa = self.factory.makeChangelog(
             'foo', ['0.32-1', '0.30-1'])
-        transaction.commit() # Yay, librarian.
+        transaction.commit()  # Yay, librarian.
         ds_diff = self.factory.makeDistroSeriesDifference(versions={
             'derived': '0.30-1',
             'parent': '0.32-1',
@@ -250,7 +270,7 @@
         changelog_lfa = self.factory.makeChangelog('foo', ['0.30-1'])
         parent_changelog_lfa = self.factory.makeChangelog(
             'foo', ['0.32-1', '0.30-1'])
-        transaction.commit() # Yay, librarian.
+        transaction.commit()  # Yay, librarian.
         ds_diff = self.factory.makeDistroSeriesDifference(versions={
             'derived': '0.32-1',
             'parent': '0.30-1',
@@ -444,9 +464,9 @@
     def test_source_diff_rendering_no_source(self):
         # If there is no source pub for this difference, then we don't
         # display even the request for a diff.
+        missing_type = DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES
         ds_diff = self.factory.makeDistroSeriesDifference(
-            difference_type=
-                (DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES))
+            difference_type=missing_type)
 
         view = create_initialized_view(ds_diff, '+listing-distroseries-extra')
         self.assertEqual(0, self.number_of_request_diff_texts(view()))
@@ -472,9 +492,9 @@
     def test_parent_source_diff_rendering_no_source(self):
         # If there is no source pub for this difference, then we don't
         # display even the request for a diff.
+        unique_type = DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES
         ds_diff = self.factory.makeDistroSeriesDifference(
-            difference_type=
-                (DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES))
+            difference_type=unique_type)
 
         view = create_initialized_view(ds_diff, '+listing-distroseries-extra')
         self.assertEqual(0, self.number_of_request_diff_texts(view()))
@@ -619,7 +639,7 @@
         changelog_lfa = self.factory.makeChangelog('foo', ['0.30-1'])
         parent_changelog_lfa = self.factory.makeChangelog(
             'foo', ['0.32-1', '0.30-1'])
-        transaction.commit() # Yay, librarian.
+        transaction.commit()  # Yay, librarian.
         ds_diff = self.factory.makeDistroSeriesDifference(versions={
             'derived': '0.30-1',
             'parent': '0.32-1',
@@ -638,8 +658,8 @@
     def test_package_diff_no_base_version(self):
         # If diff's base_version is None packages diffs are not displayed
         # and neither is the link to compute them.
-        versions={
-            'base': None, # No base version.
+        versions = {
+            'base': None,  # No base version.
             'derived': '0.1-1derived1',
             'parent': '0.1-2'}
         ds_diff = self.factory.makeDistroSeriesDifference(versions=versions)

=== modified file 'lib/lp/registry/templates/distroseries-localdifferences.pt'
--- lib/lp/registry/templates/distroseries-localdifferences.pt	2011-08-16 13:16:22 +0000
+++ lib/lp/registry/templates/distroseries-localdifferences.pt	2011-08-17 10:58:31 +0000
@@ -15,6 +15,19 @@
         /* Don't show a border between the
            difference rows and their expanded sections */
         table.listing tr.diff-extra td { border-top: 0; }
+        table.listing .diff-extra-container {
+            padding-bottom: 15px;
+        }
+        /* Clear float without adding a vertical space */
+        table.listing .clear {
+            clear: both;
+            height: 1px;
+            width: 100%;
+            margin: 0 0 -1px;
+        }
+        table.listing .blacklist-options {
+            padding-left: 1em;
+        }
       </style>
     </metal:block>
 

=== modified file 'lib/lp/registry/templates/distroseriesdifference-listing-extra.pt'
--- lib/lp/registry/templates/distroseriesdifference-listing-extra.pt	2011-08-02 08:20:42 +0000
+++ lib/lp/registry/templates/distroseriesdifference-listing-extra.pt	2011-08-17 10:58:31 +0000
@@ -22,7 +22,7 @@
 
   <div style="float: left;">
   <dl>
-    <dt>Binary descriptions:</dt>
+    <dt tal:condition="view/binary_summaries">Binary descriptions:</dt>
       <dd><ul>
         <li tal:repeat="summary view/binary_summaries">
           <tal:description replace="summary" /></li>
@@ -126,7 +126,7 @@
     </dl>
   </div>
 
-  <div style="clear:both;">&nbsp;</div>
+  <div class="clear">&nbsp;</div>
 
   <strong>Comments:</strong>
   <tal:conversation replace="structure view/@@+render"/>