Merge lp:~flacoste/launchpad/bug-365098 into lp:launchpad
- bug-365098
- Merge into devel
Proposed by
Francis J. Lacoste
Status: | Rejected |
---|---|
Rejected by: | Francis J. Lacoste |
Proposed branch: | lp:~flacoste/launchpad/bug-365098 |
Merge into: | lp:launchpad |
Diff against target: |
1121 lines (+229/-250) 16 files modified
database/sampledata/current-dev.sql (+17/-5) database/sampledata/current.sql (+17/-5) lib/canonical/launchpad/interfaces/_schema_circular_imports.py (+15/-11) lib/canonical/launchpad/security.py (+23/-36) lib/lp/app/utilities/celebrities.py (+1/-2) lib/lp/code/browser/tests/test_branchlisting.py (+4/-9) lib/lp/code/configure.zcml (+0/-11) lib/lp/code/interfaces/seriessourcepackagebranch.py (+8/-24) lib/lp/code/model/seriessourcepackagebranch.py (+11/-7) lib/lp/code/tests/helpers.py (+4/-11) lib/lp/code/tests/test_seriessourcepackagebranch.py (+14/-53) lib/lp/registry/configure.zcml (+4/-2) lib/lp/registry/interfaces/role.py (+0/-3) lib/lp/registry/interfaces/sourcepackage.py (+39/-32) lib/lp/registry/model/sourcepackage.py (+11/-6) lib/lp/registry/tests/test_sourcepackage.py (+61/-33) |
To merge this branch: | bzr merge lp:~flacoste/launchpad/bug-365098 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Launchpad code reviewers | Pending | ||
Review via email: mp+63300@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'database/sampledata/current-dev.sql' |
2 | --- database/sampledata/current-dev.sql 2011-05-04 16:46:43 +0000 |
3 | +++ database/sampledata/current-dev.sql 2011-06-02 21:22:46 +0000 |
4 | @@ -843,6 +843,9 @@ |
5 | |
6 | |
7 | |
8 | + |
9 | + |
10 | + |
11 | SET SESSION AUTHORIZATION DEFAULT; |
12 | |
13 | ALTER TABLE account DISABLE TRIGGER ALL; |
14 | @@ -1828,8 +1831,6 @@ |
15 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243624, 'Commercial Subscription Approvers', 243623, NULL, 'commercial-approvers', NULL, NULL, NULL, NULL, 1, NULL, '2008-06-27 14:49:38.676264', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
16 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243625, 'PPA key guard', NULL, NULL, 'ppa-key-guard', NULL, NULL, NULL, NULL, 1, NULL, '2008-11-04 12:59:26.965843', NULL, NULL, NULL, true, 1, '', NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436241); |
17 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243626, 'Launchpad Users', 12, NULL, 'launchpad-users', NULL, NULL, NULL, NULL, 2, NULL, '2008-11-26 18:19:53.547918', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
18 | -INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243627, 'Ubuntu-branches-owner', NULL, NULL, 'ubuntu-branches-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-03-17 07:26:14.024613', NULL, NULL, NULL, false, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436242); |
19 | -INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243628, 'Ubuntu branches', 243627, 'Celebrity team that controls official source package branches.', 'ubuntu-branches', NULL, NULL, NULL, NULL, 3, NULL, '2009-03-17 07:27:39.306182', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
20 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243629, 'Ubuntu Security Team', 4, NULL, 'ubuntu-security', NULL, NULL, NULL, NULL, 2, NULL, '2009-07-14 20:23:59.698654', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
21 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243630, 'HWDB Team', 16, NULL, 'hwdb-team', NULL, NULL, NULL, NULL, 3, NULL, '2009-07-09 09:12:39.400351', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
22 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243631, 'Techboard Owner', NULL, NULL, 'techboard-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-08-04 10:50:39.370018', NULL, NULL, NULL, true, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436243); |
23 | @@ -3800,6 +3801,13 @@ |
24 | ALTER TABLE bugsubscriptionfilterimportance ENABLE TRIGGER ALL; |
25 | |
26 | |
27 | +ALTER TABLE bugsubscriptionfiltermute DISABLE TRIGGER ALL; |
28 | + |
29 | + |
30 | + |
31 | +ALTER TABLE bugsubscriptionfiltermute ENABLE TRIGGER ALL; |
32 | + |
33 | + |
34 | ALTER TABLE bugsubscriptionfilterstatus DISABLE TRIGGER ALL; |
35 | |
36 | |
37 | @@ -4236,6 +4244,13 @@ |
38 | ALTER TABLE distroseriespackagecache ENABLE TRIGGER ALL; |
39 | |
40 | |
41 | +ALTER TABLE distroseriesparent DISABLE TRIGGER ALL; |
42 | + |
43 | + |
44 | + |
45 | +ALTER TABLE distroseriesparent ENABLE TRIGGER ALL; |
46 | + |
47 | + |
48 | ALTER TABLE emailaddress DISABLE TRIGGER ALL; |
49 | |
50 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (1, 'mark@example.com', 1, 4, '2006-10-16 18:31:43.540582', 11); |
51 | @@ -4316,7 +4331,6 @@ |
52 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (78, 'bac@canonical.com', 243623, 4, '2008-06-27 14:49:11.149508', 2436231); |
53 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (79, 'admin@canonical.com', 16, 2, '2008-08-05 12:01:32.086327', 161); |
54 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (80, 'ppa-key-guard@launchpad.net', 243625, 4, '2008-11-04 12:59:26.965843', 2436241); |
55 | -INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (81, 'ubuntu-branches-owner@example.com', 243627, 4, '2009-03-17 07:26:14.024613', 2436242); |
56 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (82, 'techboard-owner@example.com', 243631, 4, '2009-08-04 10:50:39.383407', 2436243); |
57 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (93, 'software-center-agent@example.com', 243651, 4, '2010-07-12 09:48:27.198885', 243637); |
58 | |
59 | @@ -5271,8 +5285,6 @@ |
60 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243624, 'Commercial Subscription Approvers', 243623, NULL, 'commercial-approvers', NULL, NULL, NULL, NULL, 1, NULL, '2008-06-27 14:49:38.676264', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
61 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243625, 'PPA key guard', NULL, NULL, 'ppa-key-guard', NULL, NULL, NULL, NULL, 1, NULL, '2008-11-04 12:59:26.965843', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 1, '', NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436241); |
62 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243626, 'Launchpad Users', 12, NULL, 'launchpad-users', NULL, NULL, NULL, NULL, 2, NULL, '2008-11-26 18:19:53.547918', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
63 | -INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243627, 'Ubuntu-branches-owner', NULL, NULL, 'ubuntu-branches-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-03-17 07:26:14.024613', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436242); |
64 | -INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243628, 'Ubuntu branches', 243627, 'Celebrity team that controls official source package branches.', 'ubuntu-branches', NULL, NULL, NULL, NULL, 3, NULL, '2009-03-17 07:27:39.306182', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
65 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243629, 'Ubuntu Security Team', 4, NULL, 'ubuntu-security', NULL, NULL, NULL, NULL, 2, NULL, '2009-07-14 20:23:59.698654', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
66 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243630, 'HWDB Team', 16, NULL, 'hwdb-team', NULL, NULL, NULL, NULL, 3, NULL, '2009-07-09 09:12:39.400351', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
67 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243631, 'Techboard Owner', NULL, NULL, 'techboard-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-08-04 10:50:39.370018', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436243); |
68 | |
69 | === modified file 'database/sampledata/current.sql' |
70 | --- database/sampledata/current.sql 2011-05-04 16:46:43 +0000 |
71 | +++ database/sampledata/current.sql 2011-06-02 21:22:46 +0000 |
72 | @@ -843,6 +843,9 @@ |
73 | |
74 | |
75 | |
76 | + |
77 | + |
78 | + |
79 | SET SESSION AUTHORIZATION DEFAULT; |
80 | |
81 | ALTER TABLE account DISABLE TRIGGER ALL; |
82 | @@ -1828,8 +1831,6 @@ |
83 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243624, 'Commercial Subscription Approvers', 243623, NULL, 'commercial-approvers', NULL, NULL, NULL, NULL, 1, NULL, '2008-06-27 14:49:38.676264', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
84 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243625, 'PPA key guard', NULL, NULL, 'ppa-key-guard', NULL, NULL, NULL, NULL, 1, NULL, '2008-11-04 12:59:26.965843', NULL, NULL, NULL, true, 1, '', NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436241); |
85 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243626, 'Launchpad Users', 12, NULL, 'launchpad-users', NULL, NULL, NULL, NULL, 2, NULL, '2008-11-26 18:19:53.547918', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
86 | -INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243627, 'Ubuntu-branches-owner', NULL, NULL, 'ubuntu-branches-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-03-17 07:26:14.024613', NULL, NULL, NULL, false, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436242); |
87 | -INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243628, 'Ubuntu branches', 243627, 'Celebrity team that controls official source package branches.', 'ubuntu-branches', NULL, NULL, NULL, NULL, 3, NULL, '2009-03-17 07:27:39.306182', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
88 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243629, 'Ubuntu Security Team', 4, NULL, 'ubuntu-security', NULL, NULL, NULL, NULL, 2, NULL, '2009-07-14 20:23:59.698654', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
89 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243630, 'HWDB Team', 16, NULL, 'hwdb-team', NULL, NULL, NULL, NULL, 3, NULL, '2009-07-09 09:12:39.400351', NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
90 | INSERT INTO person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243631, 'Techboard Owner', NULL, NULL, 'techboard-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-08-04 10:50:39.370018', NULL, NULL, NULL, true, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436243); |
91 | @@ -3736,6 +3737,13 @@ |
92 | ALTER TABLE bugsubscriptionfilterimportance ENABLE TRIGGER ALL; |
93 | |
94 | |
95 | +ALTER TABLE bugsubscriptionfiltermute DISABLE TRIGGER ALL; |
96 | + |
97 | + |
98 | + |
99 | +ALTER TABLE bugsubscriptionfiltermute ENABLE TRIGGER ALL; |
100 | + |
101 | + |
102 | ALTER TABLE bugsubscriptionfilterstatus DISABLE TRIGGER ALL; |
103 | |
104 | |
105 | @@ -4169,6 +4177,13 @@ |
106 | ALTER TABLE distroseriespackagecache ENABLE TRIGGER ALL; |
107 | |
108 | |
109 | +ALTER TABLE distroseriesparent DISABLE TRIGGER ALL; |
110 | + |
111 | + |
112 | + |
113 | +ALTER TABLE distroseriesparent ENABLE TRIGGER ALL; |
114 | + |
115 | + |
116 | ALTER TABLE emailaddress DISABLE TRIGGER ALL; |
117 | |
118 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (1, 'mark@example.com', 1, 4, '2006-10-16 18:31:43.540582', 11); |
119 | @@ -4249,7 +4264,6 @@ |
120 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (78, 'bac@canonical.com', 243623, 4, '2008-06-27 14:49:11.149508', 2436231); |
121 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (79, 'admin@canonical.com', 16, 2, '2008-08-05 12:01:32.086327', 161); |
122 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (80, 'ppa-key-guard@launchpad.net', 243625, 4, '2008-11-04 12:59:26.965843', 2436241); |
123 | -INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (81, 'ubuntu-branches-owner@example.com', 243627, 4, '2009-03-17 07:26:14.024613', 2436242); |
124 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (82, 'techboard-owner@example.com', 243631, 4, '2009-08-04 10:50:39.383407', 2436243); |
125 | INSERT INTO emailaddress (id, email, person, status, date_created, account) VALUES (93, 'software-center-agent@example.com', 243651, 4, '2010-07-12 09:48:27.198885', 243637); |
126 | |
127 | @@ -5203,8 +5217,6 @@ |
128 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243624, 'Commercial Subscription Approvers', 243623, NULL, 'commercial-approvers', NULL, NULL, NULL, NULL, 1, NULL, '2008-06-27 14:49:38.676264', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
129 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243625, 'PPA key guard', NULL, NULL, 'ppa-key-guard', NULL, NULL, NULL, NULL, 1, NULL, '2008-11-04 12:59:26.965843', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 1, '', NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436241); |
130 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243626, 'Launchpad Users', 12, NULL, 'launchpad-users', NULL, NULL, NULL, NULL, 2, NULL, '2008-11-26 18:19:53.547918', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
131 | -INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243627, 'Ubuntu-branches-owner', NULL, NULL, 'ubuntu-branches-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-03-17 07:26:14.024613', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436242); |
132 | -INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243628, 'Ubuntu branches', 243627, 'Celebrity team that controls official source package branches.', 'ubuntu-branches', NULL, NULL, NULL, NULL, 3, NULL, '2009-03-17 07:27:39.306182', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
133 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243629, 'Ubuntu Security Team', 4, NULL, 'ubuntu-security', NULL, NULL, NULL, NULL, 2, NULL, '2009-07-14 20:23:59.698654', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
134 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243630, 'HWDB Team', 16, NULL, 'hwdb-team', NULL, NULL, NULL, NULL, 3, NULL, '2009-07-09 09:12:39.400351', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, NULL); |
135 | INSERT INTO lp_person (id, displayname, teamowner, teamdescription, name, language, fti, defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy, merged, datecreated, addressline1, addressline2, organization, city, province, country, postcode, phone, homepage_content, icon, mugshot, hide_email_addresses, creation_rationale, creation_comment, registrant, logo, renewal_policy, personal_standing, personal_standing_reason, mail_resumption_date, mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates, visibility, verbose_bugnotifications, account) VALUES (243631, 'Techboard Owner', NULL, NULL, 'techboard-owner', NULL, NULL, NULL, NULL, 1, NULL, '2009-08-04 10:50:39.370018', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, 1, NULL, NULL, NULL, 10, 0, NULL, NULL, 1, true, 1, true, 2436243); |
136 | |
137 | === modified file 'lib/canonical/launchpad/interfaces/_schema_circular_imports.py' |
138 | --- lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2011-05-17 14:27:34 +0000 |
139 | +++ lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2011-06-02 21:22:46 +0000 |
140 | @@ -160,7 +160,11 @@ |
141 | IProjectGroup, |
142 | IProjectGroupSet, |
143 | ) |
144 | -from lp.registry.interfaces.sourcepackage import ISourcePackage |
145 | +from lp.registry.interfaces.sourcepackage import ( |
146 | + ISourcePackage, |
147 | + ISourcePackageEdit, |
148 | + ISourcePackagePublic, |
149 | + ) |
150 | from lp.registry.interfaces.ssh import ISSHKey |
151 | from lp.registry.interfaces.teammembership import ITeamMembership |
152 | from lp.registry.interfaces.wikiname import IWikiName |
153 | @@ -226,9 +230,9 @@ |
154 | IBranch['landing_candidates'].value_type.schema = IBranchMergeProposal |
155 | IBranch['landing_targets'].value_type.schema = IBranchMergeProposal |
156 | IBranch['linkBug'].queryTaggedValue( |
157 | - LAZR_WEBSERVICE_EXPORTED)['params']['bug'].schema= IBug |
158 | + LAZR_WEBSERVICE_EXPORTED)['params']['bug'].schema = IBug |
159 | IBranch['linkSpecification'].queryTaggedValue( |
160 | - LAZR_WEBSERVICE_EXPORTED)['params']['spec'].schema= ISpecification |
161 | + LAZR_WEBSERVICE_EXPORTED)['params']['spec'].schema = ISpecification |
162 | IBranch['product'].schema = IProduct |
163 | |
164 | patch_plain_parameter_type( |
165 | @@ -243,9 +247,9 @@ |
166 | LAZR_WEBSERVICE_EXPORTED)['return_type'].schema = IBranchSubscription |
167 | IBranch['subscriptions'].value_type.schema = IBranchSubscription |
168 | IBranch['unlinkBug'].queryTaggedValue( |
169 | - LAZR_WEBSERVICE_EXPORTED)['params']['bug'].schema= IBug |
170 | + LAZR_WEBSERVICE_EXPORTED)['params']['bug'].schema = IBug |
171 | IBranch['unlinkSpecification'].queryTaggedValue( |
172 | - LAZR_WEBSERVICE_EXPORTED)['params']['spec'].schema= ISpecification |
173 | + LAZR_WEBSERVICE_EXPORTED)['params']['spec'].schema = ISpecification |
174 | |
175 | patch_entry_return_type(IBranch, '_createMergeProposal', IBranchMergeProposal) |
176 | patch_plain_parameter_type( |
177 | @@ -316,17 +320,17 @@ |
178 | LAZR_WEBSERVICE_EXPORTED)[ |
179 | 'return_type'].value_type.schema = IBinaryPackageBuild |
180 | |
181 | -ISourcePackage['distroseries'].schema = IDistroSeries |
182 | -ISourcePackage['productseries'].schema = IProductSeries |
183 | -ISourcePackage['getBranch'].queryTaggedValue( |
184 | +ISourcePackagePublic['distroseries'].schema = IDistroSeries |
185 | +ISourcePackagePublic['productseries'].schema = IProductSeries |
186 | +ISourcePackagePublic['getBranch'].queryTaggedValue( |
187 | LAZR_WEBSERVICE_EXPORTED)[ |
188 | 'params']['pocket'].vocabulary = PackagePublishingPocket |
189 | -ISourcePackage['getBranch'].queryTaggedValue( |
190 | +ISourcePackagePublic['getBranch'].queryTaggedValue( |
191 | LAZR_WEBSERVICE_EXPORTED)['return_type'].schema = IBranch |
192 | -ISourcePackage['setBranch'].queryTaggedValue( |
193 | +ISourcePackageEdit['setBranch'].queryTaggedValue( |
194 | LAZR_WEBSERVICE_EXPORTED)[ |
195 | 'params']['pocket'].vocabulary = PackagePublishingPocket |
196 | -ISourcePackage['setBranch'].queryTaggedValue( |
197 | +ISourcePackageEdit['setBranch'].queryTaggedValue( |
198 | LAZR_WEBSERVICE_EXPORTED)['params']['branch'].schema = IBranch |
199 | patch_reference_property(ISourcePackage, 'distribution', IDistribution) |
200 | |
201 | |
202 | === modified file 'lib/canonical/launchpad/security.py' |
203 | --- lib/canonical/launchpad/security.py 2011-05-27 21:12:25 +0000 |
204 | +++ lib/canonical/launchpad/security.py 2011-06-02 21:22:46 +0000 |
205 | @@ -79,10 +79,6 @@ |
206 | ) |
207 | from lp.code.interfaces.codereviewvote import ICodeReviewVoteReference |
208 | from lp.code.interfaces.diff import IPreviewDiff |
209 | -from lp.code.interfaces.seriessourcepackagebranch import ( |
210 | - IMakeOfficialBranchLinks, |
211 | - ISeriesSourcePackageBranch, |
212 | - ) |
213 | from lp.code.interfaces.sourcepackagerecipe import ISourcePackageRecipe |
214 | from lp.code.interfaces.sourcepackagerecipebuild import ( |
215 | ISourcePackageRecipeBuild, |
216 | @@ -122,6 +118,7 @@ |
217 | INameBlacklistSet, |
218 | ) |
219 | from lp.registry.interfaces.packaging import IPackaging |
220 | +from lp.registry.interfaces.pocket import PackagePublishingPocket |
221 | from lp.registry.interfaces.person import ( |
222 | IPerson, |
223 | IPersonSet, |
224 | @@ -2505,38 +2502,6 @@ |
225 | return user.in_admin or user.in_ubuntu_techboard |
226 | |
227 | |
228 | -class LinkOfficialSourcePackageBranches(AuthorizationBase): |
229 | - """Who can source packages to their official branches? |
230 | - |
231 | - Only members of the ~ubuntu-branches celebrity team! Or admins. |
232 | - """ |
233 | - |
234 | - permission = 'launchpad.Edit' |
235 | - usedfor = IMakeOfficialBranchLinks |
236 | - |
237 | - def checkUnauthenticated(self): |
238 | - return False |
239 | - |
240 | - def checkAuthenticated(self, user): |
241 | - return user.in_ubuntu_branches or user.in_admin |
242 | - |
243 | - |
244 | -class ChangeOfficialSourcePackageBranchLinks(AuthorizationBase): |
245 | - """Who can change the links from source packages to their branches? |
246 | - |
247 | - Only members of the ~ubuntu-branches celebrity team! Or admins. |
248 | - """ |
249 | - |
250 | - permission = 'launchpad.Edit' |
251 | - usedfor = ISeriesSourcePackageBranch |
252 | - |
253 | - def checkUnauthenticated(self): |
254 | - return False |
255 | - |
256 | - def checkAuthenticated(self, user): |
257 | - return user.in_ubuntu_branches or user.in_admin |
258 | - |
259 | - |
260 | class ViewPackageset(AnonymousAuthorization): |
261 | """Anyone can view an IPackageset.""" |
262 | usedfor = IPackageset |
263 | @@ -2611,3 +2576,25 @@ |
264 | |
265 | class ViewPublisherConfig(AdminByAdminsTeam): |
266 | usedfor = IPublisherConfig |
267 | + |
268 | + |
269 | +class EditSourcePackage(AuthorizationBase): |
270 | + permission = 'launchpad.Edit' |
271 | + usedfor = ISourcePackage |
272 | + |
273 | + def checkAuthenticated(self, user): |
274 | + """Anyone who can upload a package can edit it.""" |
275 | + if user.in_admin: |
276 | + return True |
277 | + |
278 | + distribution = self.obj.distribution |
279 | + if user.inTeam(distribution.owner): |
280 | + return True |
281 | + |
282 | + # checkUpload() returns the reason the user can't upload |
283 | + # or None if they are allowed. |
284 | + reason = distribution.main_archive.checkUpload( |
285 | + user.person, self.obj.distroseries, self.obj.sourcepackagename, |
286 | + component=None, pocket=PackagePublishingPocket.RELEASE, |
287 | + strict_component=False) |
288 | + return reason is None |
289 | |
290 | === modified file 'lib/lp/app/utilities/celebrities.py' |
291 | --- lib/lp/app/utilities/celebrities.py 2011-05-27 21:12:25 +0000 |
292 | +++ lib/lp/app/utilities/celebrities.py 2011-06-02 21:22:46 +0000 |
293 | @@ -101,7 +101,7 @@ |
294 | This descriptor maintains a list of names so code can detect |
295 | if a given person is a celebrity for special handling. |
296 | """ |
297 | - names = set() # Populated by the constructor. |
298 | + names = set() # Populated by the constructor. |
299 | |
300 | def __init__(self, name): |
301 | PersonCelebrityDescriptor.names.add(name) |
302 | @@ -153,7 +153,6 @@ |
303 | savannah_tracker = CelebrityDescriptor(IBugTrackerSet, 'savannah') |
304 | sourceforge_tracker = CelebrityDescriptor(IBugTrackerSet, 'sf') |
305 | ubuntu = CelebrityDescriptor(IDistributionSet, 'ubuntu') |
306 | - ubuntu_branches = PersonCelebrityDescriptor('ubuntu-branches') |
307 | ubuntu_bugzilla = CelebrityDescriptor(IBugTrackerSet, 'ubuntu-bugzilla') |
308 | ubuntu_security = PersonCelebrityDescriptor('ubuntu-security') |
309 | ubuntu_techboard = PersonCelebrityDescriptor('techboard') |
310 | |
311 | === modified file 'lib/lp/code/browser/tests/test_branchlisting.py' |
312 | --- lib/lp/code/browser/tests/test_branchlisting.py 2010-10-26 15:47:24 +0000 |
313 | +++ lib/lp/code/browser/tests/test_branchlisting.py 2011-06-02 21:22:46 +0000 |
314 | @@ -16,7 +16,6 @@ |
315 | Desc, |
316 | ) |
317 | from zope.component import getUtility |
318 | -from zope.security.proxy import removeSecurityProxy |
319 | |
320 | from canonical.launchpad.testing.pages import ( |
321 | extract_text, |
322 | @@ -32,8 +31,8 @@ |
323 | SourcePackageBranchesView, |
324 | ) |
325 | from lp.code.enums import BranchVisibilityRule |
326 | -from lp.code.interfaces.seriessourcepackagebranch import ( |
327 | - IMakeOfficialBranchLinks, |
328 | +from lp.code.model.seriessourcepackagebranch import ( |
329 | + SeriesSourcePackageBranchSet, |
330 | ) |
331 | from lp.code.model.branch import Branch |
332 | from lp.registry.interfaces.person import ( |
333 | @@ -270,15 +269,12 @@ |
334 | for i in range(branch_count)] |
335 | |
336 | official = [] |
337 | - # We don't care about who can make things official, so get rid of the |
338 | - # security proxy. |
339 | - series_set = removeSecurityProxy(getUtility(IMakeOfficialBranchLinks)) |
340 | # Sort the pocket items so RELEASE is last, and thus first popped. |
341 | pockets = sorted(PackagePublishingPocket.items, reverse=True) |
342 | for i in range(official_count): |
343 | branch = branches.pop() |
344 | pocket = pockets.pop() |
345 | - sspb = series_set.new( |
346 | + SeriesSourcePackageBranchSet.new( |
347 | distroseries, pocket, self.sourcepackagename, |
348 | branch, branch.owner) |
349 | official.append(branch) |
350 | @@ -354,8 +350,7 @@ |
351 | def test_package_development_focus(self): |
352 | # Check the bzr_identity of a development focus package branch. |
353 | branch = self.factory.makePackageBranch() |
354 | - series_set = removeSecurityProxy(getUtility(IMakeOfficialBranchLinks)) |
355 | - sspb = series_set.new( |
356 | + SeriesSourcePackageBranchSet.new( |
357 | branch.distroseries, PackagePublishingPocket.RELEASE, |
358 | branch.sourcepackagename, branch, branch.owner) |
359 | identity = "lp://dev/%s/%s" % ( |
360 | |
361 | === modified file 'lib/lp/code/configure.zcml' |
362 | --- lib/lp/code/configure.zcml 2011-05-13 16:08:03 +0000 |
363 | +++ lib/lp/code/configure.zcml 2011-06-02 21:22:46 +0000 |
364 | @@ -398,21 +398,10 @@ |
365 | <class |
366 | class="lp.code.model.seriessourcepackagebranch.SeriesSourcePackageBranch"> |
367 | <allow interface="lp.code.interfaces.seriessourcepackagebranch.ISeriesSourcePackageBranch"/> |
368 | - <require |
369 | - permission="launchpad.Edit" |
370 | - set_schema="lp.code.interfaces.seriessourcepackagebranch.ISeriesSourcePackageBranch"/> |
371 | </class> |
372 | |
373 | <securedutility |
374 | class="lp.code.model.seriessourcepackagebranch.SeriesSourcePackageBranchSet" |
375 | - provides="lp.code.interfaces.seriessourcepackagebranch.IMakeOfficialBranchLinks"> |
376 | - <allow interface="lp.code.interfaces.seriessourcepackagebranch.IMakeOfficialBranchLinks"/> |
377 | - <require |
378 | - permission="launchpad.Edit" |
379 | - interface="lp.code.interfaces.seriessourcepackagebranch.IMakeOfficialBranchLinks"/> |
380 | - </securedutility> |
381 | - <securedutility |
382 | - class="lp.code.model.seriessourcepackagebranch.SeriesSourcePackageBranchSet" |
383 | provides="lp.code.interfaces.seriessourcepackagebranch.IFindOfficialBranchLinks"> |
384 | <allow interface="lp.code.interfaces.seriessourcepackagebranch.IFindOfficialBranchLinks"/> |
385 | </securedutility> |
386 | |
387 | === modified file 'lib/lp/code/interfaces/seriessourcepackagebranch.py' |
388 | --- lib/lp/code/interfaces/seriessourcepackagebranch.py 2011-03-03 01:13:47 +0000 |
389 | +++ lib/lp/code/interfaces/seriessourcepackagebranch.py 2011-06-02 21:22:46 +0000 |
390 | @@ -9,7 +9,6 @@ |
391 | __all__ = [ |
392 | 'IFindOfficialBranchLinks', |
393 | 'ISeriesSourcePackageBranch', |
394 | - 'IMakeOfficialBranchLinks', |
395 | ] |
396 | |
397 | |
398 | @@ -33,17 +32,20 @@ |
399 | id = Int() |
400 | |
401 | distroseries = Choice( |
402 | - title=_("Series"), required=True, vocabulary='DistroSeries') |
403 | + title=_("Series"), required=True, readonly=True, |
404 | + vocabulary='DistroSeries') |
405 | |
406 | pocket = Choice( |
407 | - title=_("Pocket"), required=True, vocabulary=PackagePublishingPocket) |
408 | + title=_("Pocket"), required=True, readonly=True, |
409 | + vocabulary=PackagePublishingPocket) |
410 | |
411 | sourcepackage = Attribute('The source package') |
412 | |
413 | suite_sourcepackage = Attribute('The suite source package') |
414 | |
415 | sourcepackagename = Choice( |
416 | - title=_("Package"), required=True, vocabulary='SourcePackageName') |
417 | + title=_("Package"), required=True, |
418 | + readonly=True, vocabulary='SourcePackageName') |
419 | |
420 | branchID = Attribute('The ID of the branch.') |
421 | branch = Choice( |
422 | @@ -52,7 +54,8 @@ |
423 | registrant = Attribute("The person who registered this link.") |
424 | |
425 | date_created = Datetime( |
426 | - title=_("When the branch was linked to the distribution suite.")) |
427 | + title=_("When the branch was linked to the distribution suite."), |
428 | + readonly=True) |
429 | |
430 | |
431 | class IFindOfficialBranchLinks(Interface): |
432 | @@ -86,22 +89,3 @@ |
433 | :param distrosourcepackage: An `IDistributionSourcePackage`. |
434 | :return: An `IResultSet` of `ISeriesSourcePackageBranch` objects. |
435 | """ |
436 | - |
437 | - |
438 | -class IMakeOfficialBranchLinks(Interface): |
439 | - """A set of links from source packages in distribution suites to branches. |
440 | - |
441 | - This doesn't really make sense as an interface, but is provided to match |
442 | - the rest of Launchpad. |
443 | - """ |
444 | - |
445 | - def delete(sourcepackage, pocket): |
446 | - """Remove the SeriesSourcePackageBranch for sourcepackage and pocket. |
447 | - |
448 | - :param sourcepackage: An `ISourcePackage`. |
449 | - :param pocket: A `PackagePublishingPocket` enum item. |
450 | - """ |
451 | - |
452 | - def new(distroseries, pocket, sourcepackagename, branch, registrant, |
453 | - date_created=None): |
454 | - """Link a source package in a distribution suite to a branch.""" |
455 | |
456 | === modified file 'lib/lp/code/model/seriessourcepackagebranch.py' |
457 | --- lib/lp/code/model/seriessourcepackagebranch.py 2011-03-03 01:13:47 +0000 |
458 | +++ lib/lp/code/model/seriessourcepackagebranch.py 2011-06-02 21:22:46 +0000 |
459 | @@ -32,7 +32,6 @@ |
460 | ) |
461 | from lp.code.interfaces.seriessourcepackagebranch import ( |
462 | IFindOfficialBranchLinks, |
463 | - IMakeOfficialBranchLinks, |
464 | ISeriesSourcePackageBranch, |
465 | ) |
466 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
467 | @@ -44,7 +43,6 @@ |
468 | __storm_table__ = 'SeriesSourcePackageBranch' |
469 | implements(ISeriesSourcePackageBranch) |
470 | |
471 | - |
472 | id = Int(primary=True) |
473 | distroseriesID = Int('distroseries') |
474 | distroseries = Reference(distroseriesID, 'DistroSeries.id') |
475 | @@ -85,11 +83,12 @@ |
476 | class SeriesSourcePackageBranchSet: |
477 | """See `ISeriesSourcePackageBranchSet`.""" |
478 | |
479 | - implements(IFindOfficialBranchLinks, IMakeOfficialBranchLinks) |
480 | + implements(IFindOfficialBranchLinks) |
481 | |
482 | - def new(self, distroseries, pocket, sourcepackagename, branch, registrant, |
483 | + @staticmethod |
484 | + def new(distroseries, pocket, sourcepackagename, branch, registrant, |
485 | date_created=None): |
486 | - """See `IMakeOfficialBranchLinks`.""" |
487 | + """Link a source package in a distribution suite to a branch.""" |
488 | if date_created is None: |
489 | date_created = datetime.now(pytz.UTC) |
490 | sspb = SeriesSourcePackageBranch( |
491 | @@ -136,8 +135,13 @@ |
492 | SeriesSourcePackageBranch.sourcepackagename == |
493 | sourcepackagename.id) |
494 | |
495 | - def delete(self, sourcepackage, pocket): |
496 | - """See `IMakeOfficialBranchLinks`.""" |
497 | + @staticmethod |
498 | + def delete(sourcepackage, pocket): |
499 | + """Remove the SeriesSourcePackageBranch for sourcepackage and pocket. |
500 | + |
501 | + :param sourcepackage: An `ISourcePackage`. |
502 | + :param pocket: A `PackagePublishingPocket` enum item. |
503 | + """ |
504 | store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR) |
505 | distroseries = sourcepackage.distroseries |
506 | sourcepackagename = sourcepackage.sourcepackagename |
507 | |
508 | === modified file 'lib/lp/code/tests/helpers.py' |
509 | --- lib/lp/code/tests/helpers.py 2011-05-27 19:53:20 +0000 |
510 | +++ lib/lp/code/tests/helpers.py 2011-06-02 21:22:46 +0000 |
511 | @@ -34,8 +34,8 @@ |
512 | ) |
513 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch |
514 | from lp.code.interfaces.revision import IRevisionSet |
515 | -from lp.code.interfaces.seriessourcepackagebranch import ( |
516 | - IMakeOfficialBranchLinks, |
517 | +from lp.code.model.seriessourcepackagebranch import ( |
518 | + SeriesSourcePackageBranchSet |
519 | ) |
520 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
521 | from lp.registry.interfaces.series import SeriesStatus |
522 | @@ -89,7 +89,6 @@ |
523 | |
524 | :return: a dict of objects to put into local scope. |
525 | """ |
526 | - result = {} |
527 | eric = factory.makePerson( |
528 | name='eric', displayname='Eric the Viking', |
529 | email='eric@example.com', password='test') |
530 | @@ -135,10 +134,7 @@ |
531 | # It is possible for the param to be None, so reset to the factory |
532 | # generated one. |
533 | sourcepackagename = source_package.sourcepackagename |
534 | - # We don't care about who can make things official, so get rid of the |
535 | - # security proxy. |
536 | - series_set = removeSecurityProxy(getUtility(IMakeOfficialBranchLinks)) |
537 | - series_set.new( |
538 | + SeriesSourcePackageBranchSet.new( |
539 | distro_series, pocket, sourcepackagename, branch, branch.owner) |
540 | return branch |
541 | |
542 | @@ -177,9 +173,6 @@ |
543 | for i in range(branch_count)] |
544 | |
545 | official = [] |
546 | - # We don't care about who can make things official, so get rid of the |
547 | - # security proxy. |
548 | - series_set = removeSecurityProxy(getUtility(IMakeOfficialBranchLinks)) |
549 | # Sort the pocket items so RELEASE is last, and thus first popped. |
550 | pockets = sorted(PackagePublishingPocket.items, reverse=True) |
551 | # Since there can be only one link per pocket, max out the number of |
552 | @@ -187,7 +180,7 @@ |
553 | for i in range(min(official_count, len(pockets))): |
554 | branch = branches.pop() |
555 | pocket = pockets.pop() |
556 | - sspb = series_set.new( |
557 | + SeriesSourcePackageBranchSet.new( |
558 | series, pocket, sourcepackagename, branch, branch.owner) |
559 | official.append(branch) |
560 | |
561 | |
562 | === modified file 'lib/lp/code/tests/test_seriessourcepackagebranch.py' |
563 | --- lib/lp/code/tests/test_seriessourcepackagebranch.py 2011-05-27 21:12:25 +0000 |
564 | +++ lib/lp/code/tests/test_seriessourcepackagebranch.py 2011-06-02 21:22:46 +0000 |
565 | @@ -11,22 +11,15 @@ |
566 | import pytz |
567 | import transaction |
568 | from zope.component import getUtility |
569 | -from zope.security.interfaces import Unauthorized |
570 | -from zope.security.proxy import removeSecurityProxy |
571 | |
572 | -from canonical.launchpad.ftests import ( |
573 | - ANONYMOUS, |
574 | - login, |
575 | - login_person, |
576 | - logout, |
577 | - ) |
578 | from canonical.testing.layers import DatabaseFunctionalLayer |
579 | -from lp.app.interfaces.launchpad import ILaunchpadCelebrities |
580 | from lp.code.interfaces.seriessourcepackagebranch import ( |
581 | IFindOfficialBranchLinks, |
582 | - IMakeOfficialBranchLinks, |
583 | ISeriesSourcePackageBranch, |
584 | ) |
585 | +from lp.code.model.seriessourcepackagebranch import ( |
586 | + SeriesSourcePackageBranchSet, |
587 | + ) |
588 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
589 | from lp.testing import TestCaseWithFactory |
590 | |
591 | @@ -36,25 +29,15 @@ |
592 | |
593 | layer = DatabaseFunctionalLayer |
594 | |
595 | - def setUp(self): |
596 | - TestCaseWithFactory.setUp(self) |
597 | - person = self.factory.makePerson() |
598 | - ubuntu_branches = getUtility(ILaunchpadCelebrities).ubuntu_branches |
599 | - removeSecurityProxy(ubuntu_branches).addMember( |
600 | - person, ubuntu_branches.teamowner) |
601 | - login_person(person) |
602 | - self.addCleanup(logout) |
603 | - |
604 | def test_new_sets_attributes(self): |
605 | - # ISeriesSourcePackageBranchSet.new sets all the defined attributes on |
606 | + # SeriesSourcePackageBranchSet.new sets all the defined attributes on |
607 | # the interface. |
608 | - series_set = getUtility(IMakeOfficialBranchLinks) |
609 | distroseries = self.factory.makeDistroRelease() |
610 | sourcepackagename = self.factory.makeSourcePackageName() |
611 | registrant = self.factory.makePerson() |
612 | branch = self.factory.makeAnyBranch() |
613 | now = datetime.now(pytz.UTC) |
614 | - sspb = series_set.new( |
615 | + sspb = SeriesSourcePackageBranchSet.new( |
616 | distroseries, PackagePublishingPocket.RELEASE, sourcepackagename, |
617 | branch, registrant, now) |
618 | self.assertEqual(distroseries, sspb.distroseries) |
619 | @@ -65,28 +48,26 @@ |
620 | self.assertEqual(now, sspb.date_created) |
621 | |
622 | def test_new_inserts_into_db(self): |
623 | - # IMakeOfficialBranchLinks.new inserts the new object into the |
624 | + # SeriesSourcePackageBranchSet.new inserts the new object into the |
625 | # database, giving it an ID. |
626 | - series_set = getUtility(IMakeOfficialBranchLinks) |
627 | distroseries = self.factory.makeDistroRelease() |
628 | sourcepackagename = self.factory.makeSourcePackageName() |
629 | registrant = self.factory.makePerson() |
630 | branch = self.factory.makeAnyBranch() |
631 | - sspb = series_set.new( |
632 | + sspb = SeriesSourcePackageBranchSet.new( |
633 | distroseries, PackagePublishingPocket.RELEASE, sourcepackagename, |
634 | branch, registrant) |
635 | transaction.commit() |
636 | self.assertIsNot(sspb.id, None) |
637 | |
638 | def test_new_returns_ISeriesSourcePackageBranch(self): |
639 | - # IMakeOfficialBranchLinks.new returns an |
640 | + # SeriesSourcePackageBranchSet.new returns an |
641 | # ISeriesSourcePackageBranch, know what I mean? |
642 | - series_set = getUtility(IMakeOfficialBranchLinks) |
643 | distroseries = self.factory.makeDistroRelease() |
644 | sourcepackagename = self.factory.makeSourcePackageName() |
645 | registrant = self.factory.makePerson() |
646 | branch = self.factory.makeAnyBranch() |
647 | - sspb = series_set.new( |
648 | + sspb = SeriesSourcePackageBranchSet.new( |
649 | distroseries, PackagePublishingPocket.RELEASE, sourcepackagename, |
650 | branch, registrant) |
651 | self.assertProvides(sspb, ISeriesSourcePackageBranch) |
652 | @@ -102,10 +83,9 @@ |
653 | # IFindOfficialBranchLinks.findForSourcePackage returns a result |
654 | # set of links from the source package. Each link is an |
655 | # ISeriesSourcePackageBranch. |
656 | - make_branch_links = getUtility(IMakeOfficialBranchLinks) |
657 | branch = self.factory.makePackageBranch() |
658 | package = branch.sourcepackage |
659 | - make_branch_links.new( |
660 | + SeriesSourcePackageBranchSet.new( |
661 | package.distroseries, PackagePublishingPocket.RELEASE, |
662 | package.sourcepackagename, branch, self.factory.makePerson()) |
663 | find_branch_links = getUtility(IFindOfficialBranchLinks) |
664 | @@ -119,10 +99,9 @@ |
665 | # IFindOfficialBranchLinks.findForBranch returns a result set of |
666 | # links from the branch to source packages & pockets. Each link is an |
667 | # ISeriesSourcePackageBranch. |
668 | - make_branch_links = getUtility(IMakeOfficialBranchLinks) |
669 | branch = self.factory.makePackageBranch() |
670 | package = branch.sourcepackage |
671 | - make_branch_links.new( |
672 | + SeriesSourcePackageBranchSet.new( |
673 | package.distroseries, PackagePublishingPocket.RELEASE, |
674 | package.sourcepackagename, branch, self.factory.makePerson()) |
675 | find_branch_links = getUtility(IFindOfficialBranchLinks) |
676 | @@ -135,35 +114,17 @@ |
677 | def test_delete(self): |
678 | # `delete` ensures that there is no branch associated with that |
679 | # sourcepackage and pocket. |
680 | - make_branch_links = getUtility(IMakeOfficialBranchLinks) |
681 | branch = self.factory.makePackageBranch() |
682 | package = branch.sourcepackage |
683 | - make_branch_links.new( |
684 | + SeriesSourcePackageBranchSet.new( |
685 | package.distroseries, PackagePublishingPocket.RELEASE, |
686 | package.sourcepackagename, branch, self.factory.makePerson()) |
687 | - make_branch_links.delete(package, PackagePublishingPocket.RELEASE) |
688 | + SeriesSourcePackageBranchSet.delete( |
689 | + package, PackagePublishingPocket.RELEASE) |
690 | find_branch_links = getUtility(IFindOfficialBranchLinks) |
691 | self.assertEqual( |
692 | [], list(find_branch_links.findForSourcePackage(package))) |
693 | |
694 | - def test_cannot_edit_branch_link(self): |
695 | - # You can only edit an ISeriesSourcePackageBranch if you have edit |
696 | - # permissions, which almost no one has. |
697 | - series_set = getUtility(IMakeOfficialBranchLinks) |
698 | - distroseries = self.factory.makeDistroRelease() |
699 | - sourcepackagename = self.factory.makeSourcePackageName() |
700 | - registrant = self.factory.makePerson() |
701 | - branch = self.factory.makeAnyBranch() |
702 | - sspb = series_set.new( |
703 | - distroseries, PackagePublishingPocket.RELEASE, sourcepackagename, |
704 | - branch, registrant) |
705 | - logout() |
706 | - login(ANONYMOUS) |
707 | - self.assertRaises( |
708 | - Unauthorized, setattr, sspb, 'pocket', |
709 | - PackagePublishingPocket.BACKPORTS) |
710 | - |
711 | |
712 | def test_suite(): |
713 | return unittest.TestLoader().loadTestsFromName(__name__) |
714 | - |
715 | |
716 | === modified file 'lib/lp/registry/configure.zcml' |
717 | --- lib/lp/registry/configure.zcml 2011-05-31 07:11:18 +0000 |
718 | +++ lib/lp/registry/configure.zcml 2011-06-02 21:22:46 +0000 |
719 | @@ -1585,15 +1585,17 @@ |
720 | </securedutility> |
721 | |
722 | <!-- SourcePackage --> |
723 | - |
724 | <class |
725 | class="lp.registry.model.sourcepackage.SourcePackage"> |
726 | <allow |
727 | - interface="lp.registry.interfaces.sourcepackage.ISourcePackage"/> |
728 | + interface="lp.registry.interfaces.sourcepackage.ISourcePackagePublic"/> |
729 | <allow |
730 | interface="lp.bugs.interfaces.bugtarget.IHasBugHeat"/> |
731 | <allow |
732 | interface="lp.soyuz.interfaces.buildrecords.IHasBuildRecords"/> |
733 | + <require |
734 | + permission="launchpad.Edit" |
735 | + interface="lp.registry.interfaces.sourcepackage.ISourcePackageEdit"/> |
736 | </class> |
737 | <securedutility |
738 | component="lp.registry.model.sourcepackage.SourcePackage" |
739 | |
740 | === modified file 'lib/lp/registry/interfaces/role.py' |
741 | --- lib/lp/registry/interfaces/role.py 2011-05-27 21:25:58 +0000 |
742 | +++ lib/lp/registry/interfaces/role.py 2011-06-02 21:22:46 +0000 |
743 | @@ -112,9 +112,6 @@ |
744 | in_rosetta_experts = Bool( |
745 | title=_("True if this person is a rosetta expert."), |
746 | required=True, readonly=True) |
747 | - in_ubuntu_branches = Bool( |
748 | - title=_("True if this person is on the Ubuntu branches team."), |
749 | - required=True, readonly=True) |
750 | in_ubuntu_security = Bool( |
751 | title=_("True if this person is on the Ubuntu security team."), |
752 | required=True, readonly=True) |
753 | |
754 | === modified file 'lib/lp/registry/interfaces/sourcepackage.py' |
755 | --- lib/lp/registry/interfaces/sourcepackage.py 2011-05-12 14:55:54 +0000 |
756 | +++ lib/lp/registry/interfaces/sourcepackage.py 2011-06-02 21:22:46 +0000 |
757 | @@ -9,6 +9,8 @@ |
758 | |
759 | __all__ = [ |
760 | 'ISourcePackage', |
761 | + 'ISourcePackagePublic', |
762 | + 'ISourcePackageEdit', |
763 | 'ISourcePackageFactory', |
764 | 'SourcePackageFileType', |
765 | 'SourcePackageType', |
766 | @@ -65,26 +67,21 @@ |
767 | ) |
768 | |
769 | |
770 | -class ISourcePackage(IBugTarget, IHasBranches, IHasMergeProposals, |
771 | - IHasOfficialBugTags, IHasCodeImports, |
772 | - IHasTranslationImports, IHasTranslationTemplates): |
773 | - """A SourcePackage. See the MagicSourcePackage specification. This |
774 | - interface preserves as much as possible of the old SourcePackage |
775 | - interface from the SourcePackage table, with the new table-less |
776 | - implementation.""" |
777 | - |
778 | - export_as_webservice_entry() |
779 | +class ISourcePackagePublic(IBugTarget, IHasBranches, IHasMergeProposals, |
780 | + IHasOfficialBugTags, IHasCodeImports, |
781 | + IHasTranslationImports, IHasTranslationTemplates): |
782 | + """Public attributes for SourcePackage.""" |
783 | |
784 | id = Attribute("ID") |
785 | |
786 | name = exported( |
787 | TextLine( |
788 | - title=_("Name"), required=True, |
789 | + title=_("Name"), required=True, readonly=True, |
790 | description=_("The text name of this source package."))) |
791 | |
792 | displayname = exported( |
793 | TextLine( |
794 | - title=_("Display name"), required=True, |
795 | + title=_("Display name"), required=True, readonly=True, |
796 | description=_("A displayname, constructed, for this package"))) |
797 | |
798 | path = Attribute("A path to this package, <distro>/<series>/<package>") |
799 | @@ -107,7 +104,7 @@ |
800 | Interface, |
801 | # Really IDistribution, circular import fixed in |
802 | # _schema_circular_imports. |
803 | - title=_("Distribution"), required=True, |
804 | + title=_("Distribution"), required=True, readonly=True, |
805 | description=_("The distribution for this source package."))) |
806 | |
807 | # The interface for this is really IDistroSeries, but importing that would |
808 | @@ -115,6 +112,7 @@ |
809 | distroseries = exported( |
810 | Reference( |
811 | Interface, title=_("Distribution Series"), required=True, |
812 | + readonly=True, |
813 | description=_("The DistroSeries for this SourcePackage"))) |
814 | |
815 | sourcepackagename = Attribute("SourcePackageName") |
816 | @@ -130,7 +128,7 @@ |
817 | productseries = exported( |
818 | ReferenceChoice( |
819 | title=_("Project series"), required=False, |
820 | - vocabulary="ProductSeries", |
821 | + vocabulary="ProductSeries", readonly=True, |
822 | schema=Interface, |
823 | description=_( |
824 | "The registered project series that this source package " |
825 | @@ -265,25 +263,6 @@ |
826 | :return: An `IBranch`. |
827 | """ |
828 | |
829 | - # 'pocket' should actually be a PackagePublishingPocket, and 'branch' |
830 | - # should be IBranch, but we use the base classes to avoid circular |
831 | - # imports. Correct interface specific in _schema_circular_imports. |
832 | - @operation_parameters( |
833 | - pocket=Choice( |
834 | - title=_("Pocket"), required=True, |
835 | - vocabulary=DBEnumeratedType), |
836 | - branch=Reference(Interface, title=_("Branch"), required=False)) |
837 | - @call_with(registrant=REQUEST_USER) |
838 | - @export_write_operation() |
839 | - def setBranch(pocket, branch, registrant): |
840 | - """Set the official branch for the given pocket of this package. |
841 | - |
842 | - :param pocket: A `PackagePublishingPocket`. |
843 | - :param branch: The branch to set as the official branch. |
844 | - :param registrant: The individual who created this link. |
845 | - :return: None |
846 | - """ |
847 | - |
848 | shouldimport = Attribute("""Whether we should import this or not. |
849 | By 'import' we mean sourcerer analysis resulting in a manifest and a |
850 | set of Bazaar branches which describe the source package release. |
851 | @@ -329,6 +308,34 @@ |
852 | """ |
853 | |
854 | |
855 | +class ISourcePackageEdit(Interface): |
856 | + """SourcePackage attributes requiring launchpad.Edit.""" |
857 | + |
858 | + # 'pocket' should actually be a PackagePublishingPocket, and 'branch' |
859 | + # should be IBranch, but we use the base classes to avoid circular |
860 | + # imports. Correct interface specific in _schema_circular_imports. |
861 | + @operation_parameters( |
862 | + pocket=Choice( |
863 | + title=_("Pocket"), required=True, |
864 | + vocabulary=DBEnumeratedType), |
865 | + branch=Reference(Interface, title=_("Branch"), required=False)) |
866 | + @call_with(registrant=REQUEST_USER) |
867 | + @export_write_operation() |
868 | + def setBranch(pocket, branch, registrant): |
869 | + """Set the official branch for the given pocket of this package. |
870 | + |
871 | + :param pocket: A `PackagePublishingPocket`. |
872 | + :param branch: The branch to set as the official branch. |
873 | + :param registrant: The individual who created this link. |
874 | + :return: None |
875 | + """ |
876 | + |
877 | + |
878 | +class ISourcePackage(ISourcePackagePublic, ISourcePackageEdit): |
879 | + """A source package associated to a particular distribution series.""" |
880 | + export_as_webservice_entry() |
881 | + |
882 | + |
883 | class ISourcePackageFactory(Interface): |
884 | """A creator of source packages.""" |
885 | |
886 | |
887 | === modified file 'lib/lp/registry/model/sourcepackage.py' |
888 | --- lib/lp/registry/model/sourcepackage.py 2011-05-14 15:03:04 +0000 |
889 | +++ lib/lp/registry/model/sourcepackage.py 2011-06-02 21:22:46 +0000 |
890 | @@ -46,8 +46,8 @@ |
891 | ) |
892 | from lp.bugs.model.bugtask import BugTask |
893 | from lp.buildmaster.enums import BuildStatus |
894 | -from lp.code.interfaces.seriessourcepackagebranch import ( |
895 | - IMakeOfficialBranchLinks, |
896 | +from lp.code.model.seriessourcepackagebranch import ( |
897 | + SeriesSourcePackageBranchSet, |
898 | ) |
899 | from lp.code.model.branch import Branch |
900 | from lp.code.model.hasbranches import ( |
901 | @@ -202,8 +202,14 @@ |
902 | classProvides(ISourcePackageFactory) |
903 | |
904 | def __init__(self, sourcepackagename, distroseries): |
905 | + # We store the ID of the sourcepackagename and distroseries |
906 | + # simply because Storm can break when accessing them |
907 | + # with implicit flush is blocked (like in a permission check when |
908 | + # storing the object in the permission cache). |
909 | + self.sourcepackagenameID = sourcepackagename.id |
910 | self.sourcepackagename = sourcepackagename |
911 | self.distroseries = distroseries |
912 | + self.distroseriesID = distroseries.id |
913 | |
914 | @classmethod |
915 | def new(cls, sourcepackagename, distroseries): |
916 | @@ -585,7 +591,7 @@ |
917 | |
918 | def __hash__(self): |
919 | """See `ISourcePackage`.""" |
920 | - return hash(self.distroseries.id) ^ hash(self.sourcepackagename.id) |
921 | + return hash(self.distroseriesID) ^ hash(self.sourcepackagenameID) |
922 | |
923 | def __eq__(self, other): |
924 | """See `ISourcePackage`.""" |
925 | @@ -725,10 +731,9 @@ |
926 | |
927 | def setBranch(self, pocket, branch, registrant): |
928 | """See `ISourcePackage`.""" |
929 | - series_set = getUtility(IMakeOfficialBranchLinks) |
930 | - series_set.delete(self, pocket) |
931 | + SeriesSourcePackageBranchSet.delete(self, pocket) |
932 | if branch is not None: |
933 | - series_set.new( |
934 | + SeriesSourcePackageBranchSet.new( |
935 | self.distroseries, pocket, self.sourcepackagename, branch, |
936 | registrant) |
937 | |
938 | |
939 | === modified file 'lib/lp/registry/tests/test_sourcepackage.py' |
940 | --- lib/lp/registry/tests/test_sourcepackage.py 2011-05-27 21:12:25 +0000 |
941 | +++ lib/lp/registry/tests/test_sourcepackage.py 2011-06-02 21:22:46 +0000 |
942 | @@ -14,17 +14,14 @@ |
943 | from storm.locals import Store |
944 | import transaction |
945 | from zope.component import getUtility |
946 | +from zope.security.checker import canAccess |
947 | from zope.security.interfaces import Unauthorized |
948 | -from zope.security.proxy import removeSecurityProxy |
949 | +from zope.security.management import checkPermission |
950 | |
951 | -from canonical.launchpad.ftests import ( |
952 | - login_person, |
953 | - logout, |
954 | - ) |
955 | from canonical.testing.layers import DatabaseFunctionalLayer |
956 | from lp.app.interfaces.launchpad import ILaunchpadCelebrities |
957 | -from lp.code.interfaces.seriessourcepackagebranch import ( |
958 | - IMakeOfficialBranchLinks, |
959 | +from lp.code.model.seriessourcepackagebranch import ( |
960 | + SeriesSourcePackageBranchSet, |
961 | ) |
962 | from lp.registry.interfaces.distribution import NoPartnerArchive |
963 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
964 | @@ -48,15 +45,6 @@ |
965 | |
966 | layer = DatabaseFunctionalLayer |
967 | |
968 | - def setUp(self): |
969 | - TestCaseWithFactory.setUp(self) |
970 | - person = self.factory.makePerson() |
971 | - ubuntu_branches = getUtility(ILaunchpadCelebrities).ubuntu_branches |
972 | - removeSecurityProxy(ubuntu_branches).addMember( |
973 | - person, ubuntu_branches.teamowner) |
974 | - login_person(person) |
975 | - self.addCleanup(logout) |
976 | - |
977 | def test_path(self): |
978 | sourcepackage = self.factory.makeSourcePackage() |
979 | self.assertEqual( |
980 | @@ -79,7 +67,7 @@ |
981 | sourcepackage = self.factory.makeSourcePackage() |
982 | registrant = self.factory.makePerson() |
983 | branch = self.factory.makePackageBranch(sourcepackage=sourcepackage) |
984 | - getUtility(IMakeOfficialBranchLinks).new( |
985 | + SeriesSourcePackageBranchSet.new( |
986 | sourcepackage.distroseries, PackagePublishingPocket.RELEASE, |
987 | sourcepackage.sourcepackagename, branch, registrant) |
988 | official_branch = sourcepackage.getBranch( |
989 | @@ -92,7 +80,8 @@ |
990 | pocket = PackagePublishingPocket.RELEASE |
991 | registrant = self.factory.makePerson() |
992 | branch = self.factory.makePackageBranch(sourcepackage=sourcepackage) |
993 | - sourcepackage.setBranch(pocket, branch, registrant) |
994 | + with person_logged_in(sourcepackage.distribution.owner): |
995 | + sourcepackage.setBranch(pocket, branch, registrant) |
996 | self.assertEqual(branch, sourcepackage.getBranch(pocket)) |
997 | |
998 | def test_change_branch_once_set(self): |
999 | @@ -104,8 +93,9 @@ |
1000 | branch = self.factory.makePackageBranch(sourcepackage=sourcepackage) |
1001 | new_branch = self.factory.makePackageBranch( |
1002 | sourcepackage=sourcepackage) |
1003 | - sourcepackage.setBranch(pocket, branch, registrant) |
1004 | - sourcepackage.setBranch(pocket, new_branch, registrant) |
1005 | + with person_logged_in(sourcepackage.distribution.owner): |
1006 | + sourcepackage.setBranch(pocket, branch, registrant) |
1007 | + sourcepackage.setBranch(pocket, new_branch, registrant) |
1008 | self.assertEqual(new_branch, sourcepackage.getBranch(pocket)) |
1009 | |
1010 | def test_unsetBranch(self): |
1011 | @@ -115,8 +105,9 @@ |
1012 | pocket = PackagePublishingPocket.RELEASE |
1013 | registrant = self.factory.makePerson() |
1014 | branch = self.factory.makePackageBranch(sourcepackage=sourcepackage) |
1015 | - sourcepackage.setBranch(pocket, branch, registrant) |
1016 | - sourcepackage.setBranch(pocket, None, registrant) |
1017 | + with person_logged_in(sourcepackage.distribution.owner): |
1018 | + sourcepackage.setBranch(pocket, branch, registrant) |
1019 | + sourcepackage.setBranch(pocket, None, registrant) |
1020 | self.assertIs(None, sourcepackage.getBranch(pocket)) |
1021 | |
1022 | def test_linked_branches(self): |
1023 | @@ -125,7 +116,8 @@ |
1024 | pocket = PackagePublishingPocket.RELEASE |
1025 | registrant = self.factory.makePerson() |
1026 | branch = self.factory.makePackageBranch(sourcepackage=sourcepackage) |
1027 | - sourcepackage.setBranch(pocket, branch, registrant) |
1028 | + with person_logged_in(sourcepackage.distribution.owner): |
1029 | + sourcepackage.setBranch(pocket, branch, registrant) |
1030 | self.assertEqual( |
1031 | [(pocket, branch)], list(sourcepackage.linked_branches)) |
1032 | |
1033 | @@ -270,7 +262,7 @@ |
1034 | store = Store.of(packaging) |
1035 | with person_logged_in(packaging.owner): |
1036 | packaging.sourcepackage.deletePackaging() |
1037 | - result = store.find(Packaging, Packaging.id==packaging_id) |
1038 | + result = store.find(Packaging, Packaging.id == packaging_id) |
1039 | self.assertIs(None, result.one()) |
1040 | |
1041 | def test_setPackaging__new(self): |
1042 | @@ -469,8 +461,9 @@ |
1043 | 'user_can_change_branch': False, |
1044 | 'user_can_change_translation_usage': False, |
1045 | 'user_can_change_translations_autoimport_mode': False} |
1046 | - self.assertEqual( |
1047 | - expected, sourcepackage.getSharingDetailPermissions()) |
1048 | + with person_logged_in(self.factory.makePerson()): |
1049 | + self.assertEqual( |
1050 | + expected, sourcepackage.getSharingDetailPermissions()) |
1051 | |
1052 | def test_getSharingDetailPermissions_no_user(self): |
1053 | sourcepackage = self.factory.makeSourcePackage() |
1054 | @@ -479,7 +472,6 @@ |
1055 | 'user_can_change_branch': False, |
1056 | 'user_can_change_translation_usage': False, |
1057 | 'user_can_change_translations_autoimport_mode': False} |
1058 | - logout() |
1059 | self.assertEqual( |
1060 | expected, sourcepackage.getSharingDetailPermissions()) |
1061 | |
1062 | @@ -518,17 +510,53 @@ |
1063 | |
1064 | |
1065 | class TestSourcePackageSecurity(TestCaseWithFactory): |
1066 | - """Tests for source package branch linking security.""" |
1067 | + """Tests for source package security.""" |
1068 | |
1069 | layer = DatabaseFunctionalLayer |
1070 | |
1071 | + def test_admins_have_launchpad_Edit(self): |
1072 | + admin = self.factory.makeAdministrator() |
1073 | + sourcepackage = self.factory.makeSourcePackage() |
1074 | + with person_logged_in(admin): |
1075 | + self.failUnless( |
1076 | + checkPermission('launchpad.Edit', sourcepackage), |
1077 | + "Administrators should have launchpad.Edit on source " |
1078 | + "packages.") |
1079 | + |
1080 | + def test_distro_owner_have_launchpad_Edit(self): |
1081 | + sourcepackage = self.factory.makeSourcePackage() |
1082 | + with person_logged_in(sourcepackage.distribution.owner): |
1083 | + self.failUnless( |
1084 | + checkPermission('launchpad.Edit', sourcepackage), |
1085 | + "Distribution owner should have launchpad.Edit on source " |
1086 | + "packages.") |
1087 | + |
1088 | + def test_uploader_have_launchpad_edit(self): |
1089 | + sourcepackage = self.factory.makeSourcePackage() |
1090 | + uploader = self.factory.makePerson() |
1091 | + archive = sourcepackage.get_default_archive() |
1092 | + with person_logged_in(sourcepackage.distribution.main_archive.owner): |
1093 | + archive.newPackageUploader(uploader, sourcepackage.name) |
1094 | + with person_logged_in(uploader): |
1095 | + self.failUnless( |
1096 | + checkPermission('launchpad.Edit', sourcepackage), |
1097 | + "Uploader to the package should have launchpad.Edit on " |
1098 | + "source packages.") |
1099 | + |
1100 | + def test_john_doe_can_t_edit(self): |
1101 | + sourcepackage = self.factory.makeSourcePackage() |
1102 | + john_doe = self.factory.makePerson() |
1103 | + with person_logged_in(john_doe): |
1104 | + self.failIf( |
1105 | + checkPermission('launchpad.Edit', sourcepackage), |
1106 | + "Random user shouldn't have launchpad.Edit on source " |
1107 | + "packages.") |
1108 | + |
1109 | def test_cannot_setBranch(self): |
1110 | sourcepackage = self.factory.makeSourcePackage() |
1111 | - pocket = PackagePublishingPocket.RELEASE |
1112 | - registrant = self.factory.makePerson() |
1113 | - branch = self.factory.makePackageBranch(sourcepackage=sourcepackage) |
1114 | - self.assertRaises( |
1115 | - Unauthorized, sourcepackage.setBranch, pocket, branch, registrant) |
1116 | + self.failIf( |
1117 | + canAccess(sourcepackage, 'setBranch'), |
1118 | + "setBranch should only be available to admins and uploaders") |
1119 | |
1120 | |
1121 | class TestSourcePackageViews(TestCaseWithFactory): |