Merge lp:~cprov/launchpad/bug-391810-ppa-build-deps into lp:launchpad

Proposed by Celso Providelo
Status: Merged
Merged at revision: not available
Proposed branch: lp:~cprov/launchpad/bug-391810-ppa-build-deps
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~cprov/launchpad/bug-391810-ppa-build-deps
Reviewer Review Type Date Requested Status
Eleanor Berger (community) Approve
Review via email: mp+10264@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

= Summary =

This branch fixes two trivial UI bugs:

https://bugs.edge.launchpad.net/soyuz/+bug/391810
https://bugs.edge.launchpad.net/soyuz/+bug/399090

Both related with the logic used to present or ommit the PPA 'Build dependencies' section.

Now, we won't present empty sections if the user cannot change it and also allow owners to set dependencies before uploading sources.

== Tests ==

./bin/test -vv -t xx-edit-dependencies.txt

== Demo and Q/A ==

1. As no-priv, access https://launchpad.dev/~cprov/+archive/ppa and you won't see the 'Build dependencies' section.

2. As no-priv, access https://launchpad.dev/~no-priv/+archive/ppa and you will be able to set new dependencies even if the PPA is empty

= 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/stories/ppa/xx-edit-dependencies.txt
 lib/lp/soyuz/templates/archive-index.pt
 lib/lp/soyuz/browser/archive.py
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqJoLMACgkQ7KBXuXyZSjBJegCgnJwJ8V7HRg/qYt5G78XWkT2B
I5QAn0rLjxiyKON5oHE78eM+gPpKwSPc
=rBaW
-----END PGP SIGNATURE-----

Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/browser/archive.py'
2--- lib/lp/soyuz/browser/archive.py 2009-08-08 06:45:42 +0000
3+++ lib/lp/soyuz/browser/archive.py 2009-08-17 18:07:34 +0000
4@@ -479,6 +479,16 @@
5 """Return a dict representation of the build counters."""
6 return self.context.getBuildCounters()
7
8+ @property
9+ def show_dependencies(self):
10+ """Whether or not to present the archive-dependencies section.
11+
12+ The dependencies section is presented if there are any dependency set
13+ or if the user has permission to change it.
14+ """
15+ can_edit = check_permission('launchpad.Edit', self.context)
16+ return can_edit or self.context.dependencies
17+
18
19 class ArchiveSourcePackageListViewBase(ArchiveViewBase):
20 """Common features for archive views with lists of packages."""
21
22=== modified file 'lib/lp/soyuz/stories/ppa/xx-edit-dependencies.txt'
23--- lib/lp/soyuz/stories/ppa/xx-edit-dependencies.txt 2009-06-19 16:15:02 +0000
24+++ lib/lp/soyuz/stories/ppa/xx-edit-dependencies.txt 2009-08-17 18:07:34 +0000
25@@ -32,6 +32,29 @@
26 ...
27 Unauthorized: ..., 'launchpad.Edit')
28
29+Users are able to change dependencies of their PPAs before uploading
30+any sources.
31+
32+ >>> no_priv_browser = setupBrowser(
33+ ... auth='Basic no-priv@canonical.com:test')
34+ >>> no_priv_browser.open("http://launchpad.dev/~no-priv/+archive/ppa")
35+
36+ >>> print extract_text(find_main_content(no_priv_browser.contents))
37+ This archive is public
38+ PPA for No Privileges Person
39+ ...
40+ Build dependencies: Edit dependencies
41+ This PPA does not contain
42+ any packages yet. Find more information about how to upload
43+ packages in the PPA help page
44+
45+ >>> no_priv_browser.getLink('Edit dependencies').click()
46+ >>> print no_priv_browser.url
47+ http://launchpad.dev/~no-priv/+archive/ppa/+edit-dependencies
48+
49+ >>> print no_priv_browser.title
50+ Edit dependencies for PPA for No Privileges Person
51+
52 Only Celso and an administrator can access the 'Edit dependencies'
53 page for Celso's PPA.
54
55@@ -41,15 +64,15 @@
56 >>> cprov_browser.getLink('Edit dependencies').click()
57 >>> print cprov_browser.url
58 http://launchpad.dev/~cprov/+archive/ppa/+edit-dependencies
59- >>> cprov_browser.title
60- 'Edit dependencies for PPA for Celso Providelo'
61+ >>> print cprov_browser.title
62+ Edit dependencies for PPA for Celso Providelo
63
64 >>> admin_browser.open('http://launchpad.dev/~cprov/+archive/ppa')
65 >>> admin_browser.getLink('Edit dependencies').click()
66 >>> print admin_browser.url
67 http://launchpad.dev/~cprov/+archive/ppa/+edit-dependencies
68- >>> admin_browser.title
69- 'Edit dependencies for PPA for Celso Providelo'
70+ >>> print admin_browser.title
71+ Edit dependencies for PPA for Celso Providelo
72
73 Once accessed the page provides a way to remove recorded dependencies
74 via the POST form.
75@@ -190,13 +213,19 @@
76 >>> print_ppa_dependencies(admin_browser.contents)
77 No dependencies recorded for this PPA yet.
78
79-Once the dependencies are removed, the 'dependency-section' (including
80-the warning message) are omitted from the PPA overview page
81+Once the dependencies are removed, the 'archive-dependencies' section
82+is omitted from the PPA overview page for user without permission to
83+add new dependencies.
84
85 >>> user_browser.open('http://launchpad.dev/~cprov/+archive/ppa')
86- >>> print_tag_with_id(user_browser.contents, 'archive-dependencies')
87- Build dependencies:
88+ >>> print find_tag_by_id(
89+ ... user_browser.contents, 'archive-dependencies')
90+ None
91
92+ >>> anon_browser.open('http://launchpad.dev/~cprov/+archive/ppa')
93+ >>> print find_tag_by_id(
94+ ... user_browser.contents, 'archive-dependencies')
95+ None
96
97 == Primary dependencies ==
98
99
100=== modified file 'lib/lp/soyuz/templates/archive-index.pt'
101--- lib/lp/soyuz/templates/archive-index.pt 2009-07-17 17:59:07 +0000
102+++ lib/lp/soyuz/templates/archive-index.pt 2009-08-17 18:07:34 +0000
103@@ -182,7 +182,8 @@
104 </p>
105 </td>
106 </tr>
107- <tr id="archive-dependencies" tal:condition="archive_active">
108+ <tr id="archive-dependencies"
109+ tal:condition="view/show_dependencies">
110 <th>Build dependencies:</th>
111 <td>
112 <ul>