← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/link-deleted-recipe-ppa-page into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/link-deleted-recipe-ppa-page into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/link-deleted-recipe-ppa-page/+merge/51490

This fixes OOPS similar to 1884A1684, by showing 'deleted recipe' rather than trying to link to a deleted recipe.
-- 
https://code.launchpad.net/~stevenk/launchpad/link-deleted-recipe-ppa-page/+merge/51490
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/link-deleted-recipe-ppa-page into lp:launchpad.
=== modified file 'lib/lp/soyuz/browser/tests/test_publishing.py'
--- lib/lp/soyuz/browser/tests/test_publishing.py	2011-02-23 03:33:00 +0000
+++ lib/lp/soyuz/browser/tests/test_publishing.py	2011-02-28 04:40:11 +0000
@@ -78,3 +78,29 @@
             archive=self.archive, status=PackagePublishingStatus.PUBLISHED)
         browser = self.getViewBrowser(spph, '+listing-archive-extra')
         self.assertNotIn('Built by recipe', browser.contents)
+        
+    def test_view_with_deleted_source_package_recipe(self):
+        # If a SourcePackageRelease is linked to a deleted recipe, it is also
+        # not shown in the view.
+        sprb = self.factory.makeSourcePackageRecipeBuild(
+            archive=self.archive)
+        recipe = sprb.recipe
+        requester = sprb.requester
+        spph = self.publisher.getPubSource(
+            archive=self.archive, status=PackagePublishingStatus.PUBLISHED)
+        spph.sourcepackagerelease.source_package_recipe_build = sprb
+        with person_logged_in(recipe.owner):
+            recipe.destroySelf()
+        recipe_link_matches = soupmatchers.HTMLContains(
+            soupmatchers.Tag(
+                'link to build', 'a',
+                attrs={'href': canonical_url(sprb, force_local_path=True)},
+                text='Built'),
+            soupmatchers.Tag(
+                'requester', 'a',
+                attrs={
+                    'href': canonical_url(requester, force_local_path=True)},
+                text=requester.displayname))
+        browser = self.getViewBrowser(spph, '+listing-archive-extra')
+        self.assertThat(browser.contents, recipe_link_matches)
+        self.assertIn('deleted recipe', browser.contents)

=== modified file 'lib/lp/soyuz/templates/packagepublishing-details.pt'
--- lib/lp/soyuz/templates/packagepublishing-details.pt	2011-02-23 23:54:25 +0000
+++ lib/lp/soyuz/templates/packagepublishing-details.pt	2011-02-28 04:40:11 +0000
@@ -30,9 +30,14 @@
     </li>
     <tal:sourcepackagerecipe condition="view/is_source">
       <li tal:define="sprb context/sourcepackagerelease/source_package_recipe_build" tal:condition="sprb">
-        <a tal:attributes="href sprb/fmt:url">Built</a> by recipe 
-        <a tal:attributes="href sprb/recipe/fmt:url" tal:content="sprb/recipe/name" ></a> for 
-        <a tal:attributes="href sprb/requester/fmt:url" tal:content="sprb/requester/displayname" ></a>.
+        <a tal:attributes="href sprb/fmt:url">Built</a> by
+        <tal:existingrecipe condition="sprb/recipe">
+         recipe <a tal:attributes="href sprb/recipe/fmt:url" tal:content="sprb/recipe/name" ></a>
+        </tal:existingrecipe>
+        <tal:deletedrecipe condition="not: sprb/recipe">
+         deleted recipe
+        </tal:deletedrecipe>
+         for <a tal:attributes="href sprb/requester/fmt:url" tal:content="sprb/requester/displayname" ></a>.
       </li>
     </tal:sourcepackagerecipe>
     <li tal:condition="context/datepublished">