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

Proposed by Michael Nelson
Status: Merged
Approved by: Michael Nelson
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~michael.nelson/launchpad/493703-location-error
Merge into: lp:launchpad
Diff against target: 55 lines (+33/-2)
2 files modified
lib/lp/soyuz/browser/build.py (+4/-2)
lib/lp/soyuz/browser/tests/build-views.txt (+29/-0)
To merge this branch: bzr merge lp:~michael.nelson/launchpad/493703-location-error
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+16015@code.launchpad.net

Commit message

Ensures that deleted LFAs are not returned by the BuildView.files method.

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 by ensuring that we don't try to display files that have been deleted.

== Tests ==

bin/test -vvt build-views.txt

== Demo and Q/A ==

To QA, see the links on bug 493703.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/soyuz/browser/tests/build-views.txt
  lib/lp/soyuz/browser/build.py

== Pylint notices ==

lib/lp/soyuz/browser/build.py
    38: [F0401] Unable to import 'lazr.delegates' (No module named delegates)

Revision history for this message
Abel Deuring (adeuring) wrote :

Hi Michael,

This barach looks good. Thanks for cleaning up the mess my librarian branch caused!

Just one suggestion:

> === modified file 'lib/lp/soyuz/browser/build.py'
> --- lib/lp/soyuz/browser/build.py 2009-11-12 09:09:59 +0000
> +++ lib/lp/soyuz/browser/build.py 2009-12-11 13:06:19 +0000
> @@ -191,8 +191,10 @@
> files = []
> for package in self.context.binarypackages:
> for file in package.files:
> - files.append(
> - ProxiedLibraryFileAlias(file.libraryfile, self.context))
> + if file.libraryfile.deleted is False:

I find "if not file.libraryfile.deleted" easier to read, but that's probably a matter of taste ;)

Abel

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/browser/build.py'
2--- lib/lp/soyuz/browser/build.py 2009-11-12 09:09:59 +0000
3+++ lib/lp/soyuz/browser/build.py 2009-12-11 13:06:19 +0000
4@@ -191,8 +191,10 @@
5 files = []
6 for package in self.context.binarypackages:
7 for file in package.files:
8- files.append(
9- ProxiedLibraryFileAlias(file.libraryfile, self.context))
10+ if file.libraryfile.deleted is False:
11+ alias = ProxiedLibraryFileAlias(
12+ file.libraryfile, self.context)
13+ files.append(alias)
14
15 return files
16
17
18=== modified file 'lib/lp/soyuz/browser/tests/build-views.txt'
19--- lib/lp/soyuz/browser/tests/build-views.txt 2009-09-15 14:32:12 +0000
20+++ lib/lp/soyuz/browser/tests/build-views.txt 2009-12-11 13:06:19 +0000
21@@ -221,6 +221,35 @@
22 >>> print cprov_failed_build_view.has_published_binaries
23 True
24
25+The BuildIndex view also has a files helper which returns
26+all the files from the related binary package releases.
27+
28+ >>> hoary_pmount_build = hoary.getBuildRecords(
29+ ... build_state=BuildStatus.FULLYBUILT, name='pmount',
30+ ... arch_tag='hppa')[0]
31+ >>> hoary_pmount_build_view = create_initialized_view(
32+ ... hoary_pmount_build, '+index')
33+ >>> len(hoary_pmount_build_view.files)
34+ 1
35+ >>> deb_file = hoary_pmount_build_view.files[0]
36+ >>> print deb_file.filename
37+ pmount_1.9-1_all.deb
38+
39+Files that are still referenced by binary package releases but have
40+been deleted will not be included in the view's files.
41+
42+ >>> deb_file.deleted
43+ False
44+ >>> from zope.security.proxy import removeSecurityProxy
45+ >>> removeSecurityProxy(deb_file.context).content = None
46+ >>> deb_file.deleted
47+ True
48+
49+ >>> hoary_pmount_build_view = create_initialized_view(
50+ ... hoary_pmount_build, '+index')
51+ >>> len(hoary_pmount_build_view.files)
52+ 0
53+
54
55 == BuildRescoringView ==
56