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
=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt'
--- lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt 2009-11-09 17:08:21 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt 2009-12-11 15:34:16 +0000
@@ -109,6 +109,46 @@
109 >>> print dfiles_element.find(name='a')['href']109 >>> print dfiles_element.find(name='a')['href']
110 http://localhost:58000/40/mozilla-firefox_0.9_i386.deb110 http://localhost:58000/40/mozilla-firefox_0.9_i386.deb
111111
112If the binary package did produce files, but those files have been
113subsequently deleted, this will also be indicated and the file will
114not be linked.
115
116 First we need to get a handle on the right binary file.
117 >>> login('admin@canonical.com')
118 >>> from zope.component import getUtility
119 >>> from lp.registry.interfaces.distribution import IDistributionSet
120 >>> warty = getUtility(IDistributionSet)['ubuntu']['warty']
121 >>> firefox_build = warty.getBuildRecords(
122 ... name='mozilla-firefox', arch_tag='i386')[0]
123 >>> firefox_deb = firefox_build.binarypackages[0].files[0]
124 >>> print firefox_deb.libraryfile.filename
125 mozilla-firefox_0.9_i386.deb
126
127 Next we manually ensure that the file is deleted.
128 >>> firefox_deb.libraryfile.deleted
129 False
130 >>> from zope.security.proxy import removeSecurityProxy
131 >>> removeSecurityProxy(firefox_deb.libraryfile).content = None
132 >>> firefox_deb.libraryfile.deleted
133 True
134 >>> import transaction
135 >>> transaction.commit()
136 >>> logout()
137
138 Now reload the page to see the deleted file without the link.
139
140 >>> browser.reload()
141 >>> files_element = find_tag_by_id(browser.contents, 'files')
142 >>> print extract_text(files_element)
143 i386 build of mozilla-firefox 0.9 in ubuntu warty RELEASE
144 produced these files:
145 mozilla-firefox_0.9_i386.deb (deleted)
146
147 >>> dfiles_element = find_tag_by_id(
148 ... browser.contents, 'downloadable-files')
149 >>> print dfiles_element.find(name='a')
150 None
151
112Binary Packages with no files to present results in a clear statement152Binary Packages with no files to present results in a clear statement
113intead of a empty section.153intead of a empty section.
114154
@@ -118,7 +158,6 @@
118 i386 build of pmount 0.1-1 in ubuntu hoary RELEASE158 i386 build of pmount 0.1-1 in ubuntu hoary RELEASE
119 produced no files for this binary package.159 produced no files for this binary package.
120160
121
122== DistroArchSeries Partner Binary Package Pages ==161== DistroArchSeries Partner Binary Package Pages ==
123162
124Binary partner packages in Launchpad differ from regular packages by163Binary partner packages in Launchpad differ from regular packages by
125164
=== modified file 'lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt'
--- lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt 2009-09-15 16:44:17 +0000
+++ lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt 2009-12-11 15:34:16 +0000
@@ -46,10 +46,16 @@
46 <div id="downloadable-files">46 <div id="downloadable-files">
47 <ul tal:condition="context/files">47 <ul tal:condition="context/files">
48 <li tal:repeat="file context/files">48 <li tal:repeat="file context/files">
49 <a class="sprite"49 <tal:deleted condition="file/libraryfile/deleted">
50 tal:content="file/libraryfile/filename"50 <tal:filename content="file/libraryfile/filename" />
51 tal:attributes="href file/libraryfile/http_url"></a>51 (deleted)
52 (<span tal:replace="file/libraryfile/content/filesize/fmt:bytes" />)52 </tal:deleted>
53 <tal:not-deleted condition="not: file/libraryfile/deleted">
54 <a class="sprite"
55 tal:content="file/libraryfile/filename"
56 tal:attributes="href file/libraryfile/http_url"></a>
57 (<span tal:replace="file/libraryfile/content/filesize/fmt:bytes" />)
58 </tal:not-deleted>
53 </li>59 </li>
54 </ul>60 </ul>
55 </div>61 </div>