Merge lp:~michael.nelson/launchpad/493703-bpr-error into lp:launchpad

Proposed by Michael Nelson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/493703-bpr-error
Merge into: lp:launchpad
Prerequisite: lp:~michael.nelson/launchpad/493703-location-error
Diff against target: 83 lines (+50/-5)
2 files modified
lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt (+40/-1)
lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt (+10/-4)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/493703-bpr-error
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+16026@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

= Summary =

Stop the oops in bug 493703 from happening for binary package release pages, by ensuring that we don't try to link to, or access lfc details for deleted files.

== Tests ==

bin/test -vvt xx-distroarchseries-binpackages.txt

== Demo and Q/A ==

To QA, see the links on bug 493703.

Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt'
2--- lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt 2009-11-09 17:08:21 +0000
3+++ lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt 2009-12-11 15:34:16 +0000
4@@ -109,6 +109,46 @@
5 >>> print dfiles_element.find(name='a')['href']
6 http://localhost:58000/40/mozilla-firefox_0.9_i386.deb
7
8+If the binary package did produce files, but those files have been
9+subsequently deleted, this will also be indicated and the file will
10+not be linked.
11+
12+ First we need to get a handle on the right binary file.
13+ >>> login('admin@canonical.com')
14+ >>> from zope.component import getUtility
15+ >>> from lp.registry.interfaces.distribution import IDistributionSet
16+ >>> warty = getUtility(IDistributionSet)['ubuntu']['warty']
17+ >>> firefox_build = warty.getBuildRecords(
18+ ... name='mozilla-firefox', arch_tag='i386')[0]
19+ >>> firefox_deb = firefox_build.binarypackages[0].files[0]
20+ >>> print firefox_deb.libraryfile.filename
21+ mozilla-firefox_0.9_i386.deb
22+
23+ Next we manually ensure that the file is deleted.
24+ >>> firefox_deb.libraryfile.deleted
25+ False
26+ >>> from zope.security.proxy import removeSecurityProxy
27+ >>> removeSecurityProxy(firefox_deb.libraryfile).content = None
28+ >>> firefox_deb.libraryfile.deleted
29+ True
30+ >>> import transaction
31+ >>> transaction.commit()
32+ >>> logout()
33+
34+ Now reload the page to see the deleted file without the link.
35+
36+ >>> browser.reload()
37+ >>> files_element = find_tag_by_id(browser.contents, 'files')
38+ >>> print extract_text(files_element)
39+ i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE
40+ produced these files:
41+ mozilla-firefox_0.9_i386.deb (deleted)
42+
43+ >>> dfiles_element = find_tag_by_id(
44+ ... browser.contents, 'downloadable-files')
45+ >>> print dfiles_element.find(name='a')
46+ None
47+
48 Binary Packages with no files to present results in a clear statement
49 intead of a empty section.
50
51@@ -118,7 +158,6 @@
52 i386 build of pmount 0.1-1 in ubuntu hoary RELEASE
53 produced no files for this binary package.
54
55-
56 == DistroArchSeries Partner Binary Package Pages ==
57
58 Binary partner packages in Launchpad differ from regular packages by
59
60=== modified file 'lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt'
61--- lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt 2009-09-15 16:44:17 +0000
62+++ lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt 2009-12-11 15:34:16 +0000
63@@ -46,10 +46,16 @@
64 <div id="downloadable-files">
65 <ul tal:condition="context/files">
66 <li tal:repeat="file context/files">
67- <a class="sprite"
68- tal:content="file/libraryfile/filename"
69- tal:attributes="href file/libraryfile/http_url"></a>
70- (<span tal:replace="file/libraryfile/content/filesize/fmt:bytes" />)
71+ <tal:deleted condition="file/libraryfile/deleted">
72+ <tal:filename content="file/libraryfile/filename" />
73+ (deleted)
74+ </tal:deleted>
75+ <tal:not-deleted condition="not: file/libraryfile/deleted">
76+ <a class="sprite"
77+ tal:content="file/libraryfile/filename"
78+ tal:attributes="href file/libraryfile/http_url"></a>
79+ (<span tal:replace="file/libraryfile/content/filesize/fmt:bytes" />)
80+ </tal:not-deleted>
81 </li>
82 </ul>
83 </div>