Merge lp:~rvb/launchpad/db-add-distro-registrant into lp:launchpad/db-devel

Proposed by Raphaël Badin
Status: Merged
Approved by: Stuart Bishop
Approved revision: no longer in the source branch.
Merged at revision: 10300
Proposed branch: lp:~rvb/launchpad/db-add-distro-registrant
Merge into: lp:launchpad/db-devel
Diff against target: 658 lines (+243/-58)
18 files modified
database/sampledata/current-dev.sql (+27/-10)
database/sampledata/current.sql (+27/-10)
database/schema/comments.sql (+1/-1)
database/schema/patch-2208-53-0.sql (+20/-0)
lib/lp/app/stories/launchpad-root/site-search.txt (+5/-3)
lib/lp/registry/browser/configure.zcml (+1/-1)
lib/lp/registry/browser/distribution.py (+9/-1)
lib/lp/registry/browser/tests/test_distribution_views.py (+83/-2)
lib/lp/registry/interfaces/distribution.py (+6/-1)
lib/lp/registry/model/distribution.py (+5/-1)
lib/lp/registry/stories/distribution/xx-distribution-overview.txt (+3/-1)
lib/lp/registry/stories/webservice/xx-distribution.txt (+1/-0)
lib/lp/registry/templates/distribution-index.pt (+2/-2)
lib/lp/registry/tests/test_distribution.py (+35/-13)
lib/lp/registry/tests/test_distributionsourcepackage.py (+2/-1)
lib/lp/registry/tests/test_pillarname_triggers.py (+10/-7)
lib/lp/soyuz/doc/archive.txt (+1/-1)
lib/lp/testing/factory.py (+5/-3)
To merge this branch: bzr merge lp:~rvb/launchpad/db-add-distro-registrant
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Curtis Hovey (community) code Approve
Raphaël Badin (community) Abstain
Robert Collins db Pending
Review via email: mp+53001@code.launchpad.net

Commit message

[r=sinzui,stub][bug=727632] Add a registrant field to distribution and use this instead of owner in the UI in the 'Registered by' slot.

Description of the change

= Summary =

This branch adds a registrant field to distribution (read-only field) only filled when a distribution is registered. It also fixes the interface to display this field in the 'Registered by' slot (instead of owner).

Since it involves changing the database schema it it targeted at db-devel.

This issue was discussed with Curtis and is the first part of a refactoring which will involve moving the 'owner' field to a new 'registrant' (read-only) field for distroseries, productseries, and productrelease and fixing things accordingly (no reassignments possible for those objects and various UI fixes).

= Tests =

Added tests:
{{{
./bin/test -cvv test_distribution test_registrant_owner_differ
./bin/test -cvv test_distribution test_registrant_set_by_creation
./bin/test -cvv test_distribution test_reassign_change_owner_not_registrant
./bin/test -cvv test_distribution test_reassign_page_title
}}}

Existing impacted tests:
{{{
./bin/test -cvv test_pillarname_triggers testDistributionTable
./bin/test -cvv -t xx-distribution-launchpad-usage.txt
./bin/test -cvv -t archive.txt
./bin/test -cvv -t xx-distribution-overview.txt
./bin/test -cvv -t site-search.txt
}}}

= QA =

Create a distribution. Make sure the 'Registered by' slot displays the creator's name. Reassign the distribution by editing the maintainer. Make sure the registrant has not changed after that.

Make sure all existing distributions appear to have been registered by ~registry.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :
Download full text (5.0 KiB)

Raphaël:

This branch looks very good. I think the implementation is perfect. I have some concerns about the primary test.

> @@ -260,3 +267,79 @@
> text='Series and milestones'))
> self.assertThat(view.render(), series_header_match)
> self.assertThat(view.render(), Not(add_series_match))
> +
> +
> +class DistroRegistrantTestCase(TestCaseWithFactory):
> + """A TestCase for registrants and owners of a distribution.
> +
> + The registrant is the creator of the distribution (read-only field).
> + The owner is really the maintainer.
> + """

This test case will be difficult to extend. I think we want tests for
the model object and tests for the views. I preffer that each view (+add
and +reassign) be have separate test cases, but that may not be necessary.
Some of these tests need to move to a different directory.

    Test interfaces in lp/registry/doc
    Test models in lp/registry/tests
    Test views in lp/registry/browser/tests

Get the rest of this test case updated per my remarks that split it into
model and view tests.

> + layer = LaunchpadFunctionalLayer

This is the wrong layer. LaunchpadFunctionalLayer is slow and only needed
if you are working with the librarian (uploading/downloading/email messages).
Use
    layer = DatabaseFunctionalLayer

+ def setUp(self):
+ super(DistroRegistrantTestCase, self).setUp()
+ self.owner = self.factory.makePerson()
+ self.registrant = self.factory.makePerson()
+ self.admin = getUtility(IPersonSet).getByEmail('<email address hidden>')
+ self.registry = getUtility(IPersonSet).getByName('registry')

Let's not ever use sampledata. You do not need the admin or registy attrs.
You can use login_celebrity('admins') or `with celebrity_logged_in('admins'):`.
Both login functions create a user that is a member of the celebrity team,
'admins' or 'registry_experts', and *only* that team. The sample data
users are members of many teams and the permission may not be as you assume.

+ def test_registrant_owner_differ(self):
+ distribution = self.factory.makeDistribution(
+ name="boobuntu", owner=self.owner, registrant=self.registrant)
+ self.assertNotEqual(distribution.owner, distribution.registrant)
+ self.assertEqual(distribution.owner, self.owner)
+ self.assertEqual(distribution.registrant, self.registrant)

^ Model test. This is fine.

+ def test_registrant_set_by_creation(self):
+ """The registrant field should be set to the Person creating
+ the distribution.
+ """
+ login_person(self.admin)
+ distributionset = getUtility(IDistributionSet)
+ creation_form = {
+ 'field.name': 'newbuntu',
+ 'field.displayname': 'newbuntu',
+ 'field.title': 'newbuntu',
+ 'field.summary': 'newbuntu',
+ 'field.description': 'newbuntu',
+ 'field.domainname': 'newbuntu',
+ 'field.members': 'registry',
+ 'field.actions.save': 'Save',
+ }
+ view = create_initialized_view(
+ distributionset, '+add', principal=self.admin,
+ method='POST', form=...

Read more...

review: Needs Fixing (code)
Revision history for this message
Raphaël Badin (rvb) wrote :

Fixed the tests (used DatabaseFunctionalLayer, refactored the tests into the proper places/classes, removed the use of sampledata). Thanks for the careful review.

review: Needs Resubmitting
Revision history for this message
Raphaël Badin (rvb) :
review: Abstain
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you for restructuring the tests. I think the code and test portion of this branch is good to land.

review: Approve (code)
Revision history for this message
Robert Collins (lifeless) wrote :

This seems wrong:
+update Distribution
179 + SET registrant = (select id from Person where name='registry');

The registrant of the existing distros is the current owner, no?

Revision history for this message
Stuart Bishop (stub) wrote :

The DB change looks fine.

You need to remove the BEGIN and COMMIT statements - the tool we use to apply db patches already wraps the patches in a transaction, and adding them again will break things.

We want an index on Person.registrant (all references to Person have them, including ones like this where the small number of rows means they likely will never be used). Please add the following:

    CREATE INDEX distribution__registrant__idx ON Distribution(registrant);

DB patch number is patch-2208-53-0.sql. You need to rename the .sql file and change the value being inserted into LaunchpadDatabaseRevision to match.

review: Approve (db)
Revision history for this message
Curtis Hovey (sinzui) wrote :

The registrant certainly was not the owner. Only an admin could have registered the project. Most are registered by kiko and mthaddon. I advised that ~registry be used instead because the Admin is not the person to contact if the maintain is absent.

Revision history for this message
Robert Collins (lifeless) wrote :

On Tue, Mar 15, 2011 at 3:13 AM, Curtis Hovey
<email address hidden> wrote:
> The registrant certainly was not the owner. Only an admin could have registered the project.  Most are registered by kiko and mthaddon. I advised that ~registry be used instead because the Admin is not the person to contact if the maintain is absent.

But the registrant is not the person to contact *either*. Registrants
are uninteresting.

Revision history for this message
Raphaël Badin (rvb) wrote :

Robert Collins wrote:
> But the registrant is not the person to contact *either*. Registrants
> are uninteresting.

Curtis will correct this if I'm wrong but this change is more about
making the data in the database right. Then, once this is done, we could
change the UI to display only interesting things (especially in the slot
that displays the registrant right now).

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-03-02 21:51:45 +0000
3+++ database/sampledata/current-dev.sql 2011-03-14 14:59:36 +0000
4@@ -840,6 +840,9 @@
5
6
7
8+
9+
10+
11 SET SESSION AUTHORIZATION DEFAULT;
12
13 ALTER TABLE account DISABLE TRIGGER ALL;
14@@ -1911,21 +1914,21 @@
15
16 ALTER TABLE distribution DISABLE TRIGGER ALL;
17
18-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (1, 'ubuntu', 'Ubuntu Linux', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 'ubuntulinux.org', 17, 'Ubuntu', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 17, NULL, 1, NULL, true, true, NULL, NULL, 3, 59, NULL, NULL, '2006-10-16 18:31:43.415195', NULL, NULL, NULL, NULL, NULL, true, NULL, true, true, NULL, NULL, NULL, NULL, 20, 20, 20);
19-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (2, 'redhat', 'Redhat Advanced Server', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 'redhat.com', 1, 'Red Hat', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.417928', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
20-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (3, 'debian', 'Debian GNU/Linux', 'Debian GNU/Linux is
21+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (1, 'ubuntu', 'Ubuntu Linux', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 'ubuntulinux.org', 17, 'Ubuntu', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 17, NULL, 1, NULL, true, true, NULL, NULL, 3, 59, NULL, NULL, '2006-10-16 18:31:43.415195', NULL, NULL, NULL, NULL, NULL, true, NULL, true, true, NULL, NULL, NULL, NULL, 20, 20, 20, 60);
22+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (2, 'redhat', 'Redhat Advanced Server', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 'redhat.com', 1, 'Red Hat', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.417928', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
23+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (3, 'debian', 'Debian GNU/Linux', 'Debian GNU/Linux is
24 a non commercial distribution of a GNU/Linux Operating System for many
25 platforms.', 'debian.org', 1, 'Debian', 'Debian GNU/Linux is
26 a non commercial distribution of a GNU/Linux Operating System for many
27-platforms.', 1, NULL, 1, NULL, false, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.418942', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
28-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (4, 'gentoo', 'The Gentoo Linux', 'Gentoo is a very
29+platforms.', 1, NULL, 1, NULL, false, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.418942', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
30+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (4, 'gentoo', 'The Gentoo Linux', 'Gentoo is a very
31 customizeable GNU/Linux Distribution that is designed to let you build every
32-single package yourself, with your own preferences.', 'gentoo.org', 1, 'Gentoo', 'Gentoo is a very customizeable GNU/Linux Distribution that is designed to let you build every single package yourself, with your own preferences.', 1, NULL, 1, NULL, true, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.41974', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
33-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (5, 'kubuntu', 'Kubuntu - Free KDE-based Linux', 'Kubuntu is an entirely free Linux distribution that uses the K Desktop
34+single package yourself, with your own preferences.', 'gentoo.org', 1, 'Gentoo', 'Gentoo is a very customizeable GNU/Linux Distribution that is designed to let you build every single package yourself, with your own preferences.', 1, NULL, 1, NULL, true, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.41974', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
35+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (5, 'kubuntu', 'Kubuntu - Free KDE-based Linux', 'Kubuntu is an entirely free Linux distribution that uses the K Desktop
36 Environment as its default desktop after install.', 'kubuntu.org', 1, 'Kubuntu', 'Kubuntu is an entirely free Linux distribution that uses the K Desktop
37-Environment as its default desktop after install.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.420551', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
38-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (7, 'guadalinex', 'GuadaLinex: Linux for Andalucia', 'GuadaLinex is based on Ubuntu and adds full support for applications specific to the local environment in Andalucia.', 'guadalinex.es', 4, 'GuadaLinex', 'The GuadaLinex team produces a high quality linux for the Andalucian marketplace.', 32, NULL, 1, NULL, false, false, NULL, NULL, NULL, 4, NULL, NULL, '2006-10-16 18:31:43.421329', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
39-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (8, 'ubuntutest', 'Ubuntu Test', 'Ubuntu Test', 'ubuntulinux.org', 17, 'ubuntutest', 'Ubuntu Test summary', 17, NULL, 1, NULL, false, false, NULL, NULL, NULL, 17, NULL, NULL, '2006-10-16 18:31:43.422162', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
40+Environment as its default desktop after install.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.420551', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
41+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (7, 'guadalinex', 'GuadaLinex: Linux for Andalucia', 'GuadaLinex is based on Ubuntu and adds full support for applications specific to the local environment in Andalucia.', 'guadalinex.es', 4, 'GuadaLinex', 'The GuadaLinex team produces a high quality linux for the Andalucian marketplace.', 32, NULL, 1, NULL, false, false, NULL, NULL, NULL, 4, NULL, NULL, '2006-10-16 18:31:43.421329', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
42+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (8, 'ubuntutest', 'Ubuntu Test', 'Ubuntu Test', 'ubuntulinux.org', 17, 'ubuntutest', 'Ubuntu Test summary', 17, NULL, 1, NULL, false, false, NULL, NULL, NULL, 17, NULL, NULL, '2006-10-16 18:31:43.422162', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
43
44
45 ALTER TABLE distribution ENABLE TRIGGER ALL;
46@@ -4401,6 +4404,13 @@
47 ALTER TABLE featureflagchangelogentry ENABLE TRIGGER ALL;
48
49
50+ALTER TABLE featureflagchangelogentry DISABLE TRIGGER ALL;
51+
52+
53+
54+ALTER TABLE featureflagchangelogentry ENABLE TRIGGER ALL;
55+
56+
57 ALTER TABLE flatpackagesetinclusion DISABLE TRIGGER ALL;
58
59
60@@ -9915,6 +9925,13 @@
61 ALTER TABLE projectrelationship ENABLE TRIGGER ALL;
62
63
64+ALTER TABLE publisherconfig DISABLE TRIGGER ALL;
65+
66+
67+
68+ALTER TABLE publisherconfig ENABLE TRIGGER ALL;
69+
70+
71 ALTER TABLE pushmirroraccess DISABLE TRIGGER ALL;
72
73
74
75=== modified file 'database/sampledata/current.sql'
76--- database/sampledata/current.sql 2011-03-02 21:51:45 +0000
77+++ database/sampledata/current.sql 2011-03-14 14:59:36 +0000
78@@ -840,6 +840,9 @@
79
80
81
82+
83+
84+
85 SET SESSION AUTHORIZATION DEFAULT;
86
87 ALTER TABLE account DISABLE TRIGGER ALL;
88@@ -1911,21 +1914,21 @@
89
90 ALTER TABLE distribution DISABLE TRIGGER ALL;
91
92-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (1, 'ubuntu', 'Ubuntu Linux', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 'ubuntulinux.org', 17, 'Ubuntu', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 17, NULL, 1, NULL, true, true, NULL, NULL, 3, 59, NULL, NULL, '2006-10-16 18:31:43.415195', NULL, NULL, NULL, NULL, NULL, true, NULL, true, true, NULL, NULL, NULL, NULL, 10, 10, 10);
93-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (2, 'redhat', 'Redhat Advanced Server', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 'redhat.com', 1, 'Red Hat', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.417928', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
94-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (3, 'debian', 'Debian GNU/Linux', 'Debian GNU/Linux is
95+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (1, 'ubuntu', 'Ubuntu Linux', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 'ubuntulinux.org', 17, 'Ubuntu', 'Ubuntu is a new approach to Linux Distribution that includes regular releases, and a simplified single-CD installation system.', 17, NULL, 1, NULL, true, true, NULL, NULL, 3, 59, NULL, NULL, '2006-10-16 18:31:43.415195', NULL, NULL, NULL, NULL, NULL, true, NULL, true, true, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
96+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (2, 'redhat', 'Redhat Advanced Server', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 'redhat.com', 1, 'Red Hat', 'Red Hat is a commercial distribution of the GNU/Linux Operating System.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.417928', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
97+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (3, 'debian', 'Debian GNU/Linux', 'Debian GNU/Linux is
98 a non commercial distribution of a GNU/Linux Operating System for many
99 platforms.', 'debian.org', 1, 'Debian', 'Debian GNU/Linux is
100 a non commercial distribution of a GNU/Linux Operating System for many
101-platforms.', 1, NULL, 1, NULL, false, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.418942', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
102-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (4, 'gentoo', 'The Gentoo Linux', 'Gentoo is a very
103+platforms.', 1, NULL, 1, NULL, false, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.418942', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
104+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (4, 'gentoo', 'The Gentoo Linux', 'Gentoo is a very
105 customizeable GNU/Linux Distribution that is designed to let you build every
106-single package yourself, with your own preferences.', 'gentoo.org', 1, 'Gentoo', 'Gentoo is a very customizeable GNU/Linux Distribution that is designed to let you build every single package yourself, with your own preferences.', 1, NULL, 1, NULL, true, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.41974', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
107-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (5, 'kubuntu', 'Kubuntu - Free KDE-based Linux', 'Kubuntu is an entirely free Linux distribution that uses the K Desktop
108+single package yourself, with your own preferences.', 'gentoo.org', 1, 'Gentoo', 'Gentoo is a very customizeable GNU/Linux Distribution that is designed to let you build every single package yourself, with your own preferences.', 1, NULL, 1, NULL, true, false, NULL, NULL, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.41974', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
109+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (5, 'kubuntu', 'Kubuntu - Free KDE-based Linux', 'Kubuntu is an entirely free Linux distribution that uses the K Desktop
110 Environment as its default desktop after install.', 'kubuntu.org', 1, 'Kubuntu', 'Kubuntu is an entirely free Linux distribution that uses the K Desktop
111-Environment as its default desktop after install.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.420551', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
112-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (7, 'guadalinex', 'GuadaLinex: Linux for Andalucia', 'GuadaLinex is based on Ubuntu and adds full support for applications specific to the local environment in Andalucia.', 'guadalinex.es', 4, 'GuadaLinex', 'The GuadaLinex team produces a high quality linux for the Andalucian marketplace.', 32, NULL, 1, NULL, false, false, NULL, NULL, NULL, 4, NULL, NULL, '2006-10-16 18:31:43.421329', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
113-INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage) VALUES (8, 'ubuntutest', 'Ubuntu Test', 'Ubuntu Test', 'ubuntulinux.org', 17, 'ubuntutest', 'Ubuntu Test summary', 17, NULL, 1, NULL, false, false, NULL, NULL, NULL, 17, NULL, NULL, '2006-10-16 18:31:43.422162', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10);
114+Environment as its default desktop after install.', 1, NULL, 1, NULL, false, false, NULL, 8, NULL, 1, NULL, NULL, '2006-10-16 18:31:43.420551', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
115+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (7, 'guadalinex', 'GuadaLinex: Linux for Andalucia', 'GuadaLinex is based on Ubuntu and adds full support for applications specific to the local environment in Andalucia.', 'guadalinex.es', 4, 'GuadaLinex', 'The GuadaLinex team produces a high quality linux for the Andalucian marketplace.', 32, NULL, 1, NULL, false, false, NULL, NULL, NULL, 4, NULL, NULL, '2006-10-16 18:31:43.421329', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
116+INSERT INTO distribution (id, name, title, description, domainname, owner, displayname, summary, members, translationgroup, translationpermission, bug_supervisor, official_malone, official_rosetta, security_contact, driver, translation_focus, mirror_admin, upload_admin, upload_sender, date_created, homepage_content, icon, mugshot, logo, fti, official_answers, language_pack_admin, official_blueprints, enable_bug_expiration, bug_reporting_guidelines, reviewer_whiteboard, max_bug_heat, bug_reported_acknowledgement, answers_usage, blueprints_usage, translations_usage, registrant) VALUES (8, 'ubuntutest', 'Ubuntu Test', 'Ubuntu Test', 'ubuntulinux.org', 17, 'ubuntutest', 'Ubuntu Test summary', 17, NULL, 1, NULL, false, false, NULL, NULL, NULL, 17, NULL, NULL, '2006-10-16 18:31:43.422162', NULL, NULL, NULL, NULL, NULL, false, NULL, false, false, NULL, NULL, NULL, NULL, 10, 10, 10, 60);
117
118
119 ALTER TABLE distribution ENABLE TRIGGER ALL;
120@@ -4406,6 +4409,13 @@
121 ALTER TABLE featureflagchangelogentry ENABLE TRIGGER ALL;
122
123
124+ALTER TABLE featureflagchangelogentry DISABLE TRIGGER ALL;
125+
126+
127+
128+ALTER TABLE featureflagchangelogentry ENABLE TRIGGER ALL;
129+
130+
131 ALTER TABLE flatpackagesetinclusion DISABLE TRIGGER ALL;
132
133
134@@ -9920,6 +9930,13 @@
135 ALTER TABLE projectrelationship ENABLE TRIGGER ALL;
136
137
138+ALTER TABLE publisherconfig DISABLE TRIGGER ALL;
139+
140+
141+
142+ALTER TABLE publisherconfig ENABLE TRIGGER ALL;
143+
144+
145 ALTER TABLE pushmirroraccess DISABLE TRIGGER ALL;
146
147
148
149=== modified file 'database/schema/comments.sql'
150--- database/schema/comments.sql 2011-03-07 22:02:45 +0000
151+++ database/schema/comments.sql 2011-03-14 14:59:36 +0000
152@@ -1098,7 +1098,7 @@
153 COMMENT ON COLUMN Distribution.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';
154 COMMENT ON COLUMN Distribution.max_bug_heat IS 'The highest heat value across bugs for this distribution.';
155 COMMENT ON COLUMN Distribution.bug_reported_acknowledgement IS 'A message of acknowledgement to display to a bug reporter after they\'ve reported a new bug.';
156-
157+COMMENT ON COLUMN Distribution.registrant IS 'The person in launchpad who registered this distribution.';
158
159 -- DistroSeries
160
161
162=== added file 'database/schema/patch-2208-53-0.sql'
163--- database/schema/patch-2208-53-0.sql 1970-01-01 00:00:00 +0000
164+++ database/schema/patch-2208-53-0.sql 2011-03-14 14:59:36 +0000
165@@ -0,0 +1,20 @@
166+-- Copyright 2009 Canonical Ltd. This software is licensed under the
167+-- GNU Affero General Public License version 3 (see the file LICENSE).
168+
169+SET client_min_messages=ERROR;
170+
171+-- Add a registrant column to distributions.
172+ALTER TABLE Distribution
173+ ADD COLUMN registrant integer REFERENCES Person;
174+
175+-- Set registrant to owner for existing distros.
176+update Distribution
177+ SET registrant = owner;
178+
179+-- Add NOT NULL constraint to registrant column.
180+ALTER TABLE Distribution ALTER COLUMN registrant SET NOT NULL;
181+
182+-- Add index to registrant column.
183+CREATE INDEX distribution__registrant__idx ON Distribution(registrant);
184+
185+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 53, 0);
186
187=== modified file 'lib/lp/app/stories/launchpad-root/site-search.txt'
188--- lib/lp/app/stories/launchpad-root/site-search.txt 2011-02-17 17:02:54 +0000
189+++ lib/lp/app/stories/launchpad-root/site-search.txt 2011-03-14 14:59:36 +0000
190@@ -181,9 +181,11 @@
191 >>> print_search_results()
192 Exact matches
193 Ubuntu
194- Ubuntu is a new approach to Linux Distribution that includes regular
195- releases, and a simplified single-CD installation system.
196- Registered on 2006-10-16
197+ Ubuntu is a new approach to Linux Distribution that includes ...
198+ Registered
199+ by
200+ Registry Administrators
201+ on 2006-10-16
202
203 The user enters the number 1, and he sees a bug and a question in the
204 "Exact matches" section.
205
206=== modified file 'lib/lp/registry/browser/configure.zcml'
207--- lib/lp/registry/browser/configure.zcml 2011-03-08 14:25:42 +0000
208+++ lib/lp/registry/browser/configure.zcml 2011-03-14 14:59:36 +0000
209@@ -1948,7 +1948,7 @@
210 for="lp.registry.interfaces.distribution.IDistribution"
211 permission="launchpad.Edit"
212 facet="overview"
213- class="canonical.launchpad.browser.ObjectReassignmentView">
214+ class="lp.registry.browser.distribution.DistributionReassignmentView">
215 <browser:page
216 name="+reassign"
217 template="../../../canonical/launchpad/templates/object-reassignment.pt"/>
218
219=== modified file 'lib/lp/registry/browser/distribution.py'
220--- lib/lp/registry/browser/distribution.py 2011-03-10 15:10:37 +0000
221+++ lib/lp/registry/browser/distribution.py 2011-03-14 14:59:36 +0000
222@@ -22,6 +22,7 @@
223 'DistributionPackageSearchView',
224 'DistributionPendingReviewMirrorsView',
225 'DistributionPublisherConfigView',
226+ 'DistributionReassignmentView',
227 'DistributionSeriesView',
228 'DistributionSeriesMirrorsRSSView',
229 'DistributionSeriesMirrorsView',
230@@ -98,6 +99,7 @@
231 RegistryCollectionActionMenuBase,
232 )
233 from lp.registry.browser.pillar import PillarBugsMenu
234+from lp.registry.browser.objectreassignment import ObjectReassignmentView
235 from lp.registry.interfaces.distribution import (
236 IDerivativeDistribution,
237 IDistribution,
238@@ -336,7 +338,7 @@
239
240 @enabled_with_permission('launchpad.Edit')
241 def reassign(self):
242- text = 'Change registrant'
243+ text = 'Change maintainer'
244 return Link('+reassign', text, icon='edit')
245
246 def newmirror(self):
247@@ -781,6 +783,7 @@
248 domainname=data['domainname'],
249 members=data['members'],
250 owner=self.user,
251+ registrant=self.user,
252 )
253 notify(ObjectCreatedEvent(distribution))
254 self.next_url = canonical_url(distribution)
255@@ -1094,6 +1097,11 @@
256 return self.context.disabled_mirrors
257
258
259+class DistributionReassignmentView(ObjectReassignmentView):
260+ """View class for changing distribution maintainer."""
261+ ownerOrMaintainerName = 'maintainer'
262+
263+
264 class DistributionPublisherConfigView(LaunchpadFormView):
265 """View class for configuring publisher options for a DistroSeries.
266
267
268=== renamed file 'lib/lp/registry/browser/tests/test_distribution.py' => 'lib/lp/registry/browser/tests/test_distribution_views.py'
269--- lib/lp/registry/browser/tests/test_distribution.py 2011-03-10 10:59:11 +0000
270+++ lib/lp/registry/browser/tests/test_distribution_views.py 2011-03-14 14:59:36 +0000
271@@ -3,15 +3,21 @@
272
273 __metaclass__ = type
274
275+import soupmatchers
276 from zope.component import getUtility
277
278-from canonical.testing.layers import DatabaseFunctionalLayer
279 from canonical.launchpad.ftests import login
280 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
281+from canonical.testing.layers import DatabaseFunctionalLayer
282 from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
283 from lp.registry.browser.distribution import DistributionPublisherConfigView
284-from lp.testing import TestCaseWithFactory
285+from lp.registry.interfaces.distribution import IDistributionSet
286+from lp.testing import (
287+ login_celebrity,
288+ TestCaseWithFactory,
289+ )
290 from lp.testing.sampledata import LAUNCHPAD_ADMIN
291+from lp.testing.views import create_initialized_view
292
293
294 class TestDistributionPublisherConfigView(TestCaseWithFactory):
295@@ -84,3 +90,78 @@
296 copy_base_url=u"foo",
297 )
298 self._change_and_test_config()
299+
300+
301+class TestDistroAddView(TestCaseWithFactory):
302+ """Test the +add page for a new distribution."""
303+
304+ layer = DatabaseFunctionalLayer
305+
306+ def setUp(self):
307+ super(TestDistroAddView, self).setUp()
308+ self.owner = self.factory.makePerson()
309+ self.registrant = self.factory.makePerson()
310+ self.simple_user = self.factory.makePerson()
311+
312+ def test_registrant_set_by_creation(self):
313+ # The registrant field should be set to the Person creating
314+ # the distribution.
315+ admin = login_celebrity('admin')
316+ distributionset = getUtility(IDistributionSet)
317+ creation_form = {
318+ 'field.name': 'newbuntu',
319+ 'field.displayname': 'newbuntu',
320+ 'field.title': 'newbuntu',
321+ 'field.summary': 'newbuntu',
322+ 'field.description': 'newbuntu',
323+ 'field.domainname': 'newbuntu',
324+ 'field.members': self.simple_user.name,
325+ 'field.actions.save': 'Save',
326+ }
327+ view = create_initialized_view(
328+ distributionset, '+add', principal=admin,
329+ method='POST', form=creation_form)
330+ distribution = distributionset.getByName('newbuntu')
331+ self.assertEqual(distribution.owner, admin)
332+ self.assertEqual(distribution.registrant, admin)
333+
334+
335+class TestDistroReassignView(TestCaseWithFactory):
336+ """Test the +reassign page for a new distribution."""
337+
338+ layer = DatabaseFunctionalLayer
339+
340+ def setUp(self):
341+ super(TestDistroReassignView, self).setUp()
342+ self.owner = self.factory.makePerson()
343+ self.registrant = self.factory.makePerson()
344+ self.simple_user = self.factory.makePerson()
345+
346+ def test_reassign_distro_change_owner_not_registrant(self):
347+ # Reassigning a distribution should not change the registrant.
348+ admin = login_celebrity('admin')
349+ distribution = self.factory.makeDistribution(
350+ name="boobuntu", owner=self.owner, registrant=self.registrant)
351+ reassign_form = {
352+ 'field.owner': self.simple_user.name,
353+ 'field.existing': 'existing',
354+ 'field.actions.change': 'Change',
355+ }
356+ view = create_initialized_view(
357+ distribution, '+reassign', principal=admin,
358+ method='POST', form=reassign_form)
359+ self.assertEqual(distribution.owner, self.simple_user)
360+ self.assertEqual(distribution.registrant, self.registrant)
361+
362+ def test_reassign_distro_page_title(self):
363+ # Reassign should say maintainer instead of owner.
364+ admin = login_celebrity('admin')
365+ distribution = self.factory.makeDistribution(
366+ name="boobuntu", owner=self.owner, registrant=self.registrant)
367+ view = create_initialized_view(
368+ distribution, '+reassign', principal=admin, method='GET')
369+ header_match = soupmatchers.HTMLContains(
370+ soupmatchers.Tag(
371+ 'Header should say maintainer (not owner)', 'h1',
372+ text='Change the maintainer of Boobuntu'))
373+ self.assertThat(view.render(), header_match)
374
375=== modified file 'lib/lp/registry/interfaces/distribution.py'
376--- lib/lp/registry/interfaces/distribution.py 2011-02-24 15:30:54 +0000
377+++ lib/lp/registry/interfaces/distribution.py 2011-03-14 14:59:36 +0000
378@@ -209,6 +209,11 @@
379 PublicPersonChoice(
380 title=_("Owner"), vocabulary='ValidOwner',
381 description=_("The distro's owner."), required=True))
382+ registrant = exported(
383+ PublicPersonChoice(
384+ title=_("Registrant"), vocabulary='ValidPersonOrTeam',
385+ description=_("The distro's registrant."), required=True,
386+ readonly=True))
387 date_created = exported(
388 Datetime(title=_('Date created'),
389 description=_("The date this distribution was registered.")))
390@@ -689,7 +694,7 @@
391 """Return the IDistribution with the given name or None."""
392
393 def new(name, displayname, title, description, summary, domainname,
394- members, owner, mugshot=None, logo=None, icon=None):
395+ members, owner, registrant, mugshot=None, logo=None, icon=None):
396 """Create a new distribution."""
397
398 def getCurrentSourceReleases(distro_to_source_packagenames):
399
400=== modified file 'lib/lp/registry/model/distribution.py'
401--- lib/lp/registry/model/distribution.py 2011-03-01 05:05:26 +0000
402+++ lib/lp/registry/model/distribution.py 2011-03-14 14:59:36 +0000
403@@ -243,6 +243,9 @@
404 owner = ForeignKey(
405 dbName='owner', foreignKey='Person',
406 storm_validator=validate_public_person, notNull=True)
407+ registrant = ForeignKey(
408+ dbName='registrant', foreignKey='Person',
409+ storm_validator=validate_public_person, notNull=True)
410 bug_supervisor = ForeignKey(
411 dbName='bug_supervisor', foreignKey='Person',
412 storm_validator=validate_person,
413@@ -1882,7 +1885,7 @@
414 return pillar
415
416 def new(self, name, displayname, title, description, summary, domainname,
417- members, owner, mugshot=None, logo=None, icon=None):
418+ members, owner, registrant, mugshot=None, logo=None, icon=None):
419 """See `IDistributionSet`."""
420 distro = Distribution(
421 name=name,
422@@ -1894,6 +1897,7 @@
423 members=members,
424 mirror_admin=owner,
425 owner=owner,
426+ registrant=registrant,
427 mugshot=mugshot,
428 logo=logo,
429 icon=icon)
430
431=== modified file 'lib/lp/registry/stories/distribution/xx-distribution-overview.txt'
432--- lib/lp/registry/stories/distribution/xx-distribution-overview.txt 2010-05-17 20:09:03 +0000
433+++ lib/lp/registry/stories/distribution/xx-distribution-overview.txt 2011-03-14 14:59:36 +0000
434@@ -89,7 +89,9 @@
435
436 >>> print extract_text(
437 ... find_tag_by_id(anon_browser.contents, 'registration'))
438- registered by Ubuntu Team on 2006-10-16
439+ Registered by
440+ Registry Administrators
441+ on 2006-10-16
442
443 >>> print extract_text(find_main_content(anon_browser.contents))
444 Ubuntu Linux
445
446=== modified file 'lib/lp/registry/stories/webservice/xx-distribution.txt'
447--- lib/lp/registry/stories/webservice/xx-distribution.txt 2011-02-13 22:54:48 +0000
448+++ lib/lp/registry/stories/webservice/xx-distribution.txt 2011-03-14 14:59:36 +0000
449@@ -43,6 +43,7 @@
450 name: u'ubuntu'
451 official_bug_tags: []
452 owner_link: u'http://.../~ubuntu-team'
453+ registrant_link: u'http://.../~registry'
454 resource_type_link: u'http://.../#distribution'
455 security_contact_link: None
456 self_link: u'http://.../ubuntu'
457
458=== modified file 'lib/lp/registry/templates/distribution-index.pt'
459--- lib/lp/registry/templates/distribution-index.pt 2010-10-10 21:54:16 +0000
460+++ lib/lp/registry/templates/distribution-index.pt 2011-03-14 14:59:36 +0000
461@@ -11,8 +11,8 @@
462 </tal:heading>
463
464 <tal:registering metal:fill-slot="registering">
465- registered by
466- <a tal:replace="structure context/owner/fmt:link" />
467+ Registered by
468+ <a tal:replace="structure context/registrant/fmt:link" />
469 <span tal:content="context/date_created/fmt:displaydate"
470 tal:attributes="title context/date_created/fmt:datetime"
471 >on 2005-01-01</span>
472
473=== modified file 'lib/lp/registry/tests/test_distribution.py'
474--- lib/lp/registry/tests/test_distribution.py 2011-03-03 15:45:58 +0000
475+++ lib/lp/registry/tests/test_distribution.py 2011-03-14 14:59:36 +0000
476@@ -5,14 +5,20 @@
477
478 __metaclass__ = type
479
480+from lazr.lifecycle.snapshot import Snapshot
481+import soupmatchers
482+from testtools.matchers import (
483+ MatchesAny,
484+ Not,
485+ )
486+from zope.component import getUtility
487+from zope.security.proxy import removeSecurityProxy
488+
489 from canonical.launchpad.webapp import canonical_url
490 from canonical.testing.layers import (
491 DatabaseFunctionalLayer,
492 LaunchpadFunctionalLayer,
493 )
494-
495-from lazr.lifecycle.snapshot import Snapshot
496-
497 from lp.registry.errors import NoSuchDistroSeries
498 from lp.registry.interfaces.distribution import IDistribution
499 from lp.registry.interfaces.person import IPersonSet
500@@ -24,18 +30,12 @@
501 from lp.soyuz.interfaces.distributionsourcepackagerelease import (
502 IDistributionSourcePackageRelease,
503 )
504-from lp.testing import TestCaseWithFactory
505-from lp.testing import login_person
506+from lp.testing import (
507+ login_person,
508+ TestCaseWithFactory,
509+ )
510 from lp.testing.views import create_initialized_view
511
512-from testtools.matchers import MatchesAny
513-from testtools.matchers import Not
514-
515-import soupmatchers
516-
517-from zope.component import getUtility
518-from zope.security.proxy import removeSecurityProxy
519-
520
521 class TestDistribution(TestCaseWithFactory):
522
523@@ -260,3 +260,25 @@
524 text='Series and milestones'))
525 self.assertThat(view.render(), series_header_match)
526 self.assertThat(view.render(), Not(add_series_match))
527+
528+
529+class DistroRegistrantTestCase(TestCaseWithFactory):
530+ """A TestCase for registrants and owners of a distribution.
531+
532+ The registrant is the creator of the distribution (read-only field).
533+ The owner is really the maintainer.
534+ """
535+
536+ layer = DatabaseFunctionalLayer
537+
538+ def setUp(self):
539+ super(DistroRegistrantTestCase, self).setUp()
540+ self.owner = self.factory.makePerson()
541+ self.registrant = self.factory.makePerson()
542+
543+ def test_distro_registrant_owner_differ(self):
544+ distribution = self.factory.makeDistribution(
545+ name="boobuntu", owner=self.owner, registrant=self.registrant)
546+ self.assertNotEqual(distribution.owner, distribution.registrant)
547+ self.assertEqual(distribution.owner, self.owner)
548+ self.assertEqual(distribution.registrant, self.registrant)
549
550=== modified file 'lib/lp/registry/tests/test_distributionsourcepackage.py'
551--- lib/lp/registry/tests/test_distributionsourcepackage.py 2010-10-04 19:50:45 +0000
552+++ lib/lp/registry/tests/test_distributionsourcepackage.py 2011-03-14 14:59:36 +0000
553@@ -32,7 +32,8 @@
554 distribution = distribution_set.new(name='wart',
555 displayname='wart', title='wart', description='lots of warts',
556 summary='lots of warts', domainname='wart.dumb',
557- members=self.factory.makeTeam(), owner=self.factory.makePerson())
558+ members=self.factory.makeTeam(), owner=self.factory.makePerson(),
559+ registrant=self.factory.makePerson())
560 naked_distribution = removeSecurityProxy(distribution)
561 self.factory.makeSourcePackage(distroseries=distribution)
562 dsp = naked_distribution.getSourcePackage(name='pmount')
563
564=== modified file 'lib/lp/registry/tests/test_pillarname_triggers.py'
565--- lib/lp/registry/tests/test_pillarname_triggers.py 2010-10-04 19:50:45 +0000
566+++ lib/lp/registry/tests/test_pillarname_triggers.py 2011-03-14 14:59:36 +0000
567@@ -46,12 +46,12 @@
568 # Inserting a new Distribution will populate PillarName
569 cur.execute("""
570 INSERT INTO Distribution (
571- name, description, domainname, owner, displayname,
572- summary, title, members, mirror_admin
573+ name, description, domainname, owner, registrant,
574+ displayname, summary, title, members, mirror_admin
575 )
576 VALUES (
577- 'whatever', 'whatever', 'whatever', 1, 'whatever',
578- 'whatever', 'whatever', 1, 1
579+ 'whatever', 'whatever', 'whatever', 1, 1,
580+ 'whatever', 'whatever', 'whatever', 1, 1
581 )
582 """)
583 self.failUnless(is_in_sync('whatever'))
584@@ -69,7 +69,8 @@
585 """)
586 self.failUnless(is_in_sync('whatever2'))
587
588- # Deleting a Distribution removes the corresponding entry in PillarName
589+ # Deleting a Distribution removes the corresponding entry in
590+ # PillarName
591 cur.execute("DELETE FROM Distribution WHERE name='whatever2'")
592 cur.execute("SELECT COUNT(*) FROM PillarName WHERE name='whatever2'")
593 self.failUnlessEqual(cur.fetchone()[0], 0)
594@@ -101,7 +102,8 @@
595
596 # Inserting a new Product will populate PillarName
597 cur.execute("""
598- INSERT INTO Product (owner, registrant, name, displayname, title, summary)
599+ INSERT INTO Product (
600+ owner, registrant, name, displayname, title, summary)
601 VALUES (
602 1, 1, 'whatever', 'whatever', 'whatever', 'whatever'
603 )
604@@ -154,7 +156,8 @@
605 # Inserting a new ProjectGroup will populate PillarName
606 cur.execute("""
607 INSERT INTO Project (
608- name, owner, registrant, displayname, title, summary, description
609+ name, owner, registrant, displayname, title, summary,
610+ description
611 )
612 VALUES (
613 'whatever', 1, 1, 'whatever', 'whatever',
614
615=== modified file 'lib/lp/soyuz/doc/archive.txt'
616--- lib/lp/soyuz/doc/archive.txt 2011-03-03 00:43:44 +0000
617+++ lib/lp/soyuz/doc/archive.txt 2011-03-14 14:59:36 +0000
618@@ -2460,7 +2460,7 @@
619 >>> uber = getUtility(IDistributionSet).new(
620 ... 'uberdistro', 'The uberdistro', 'The mother of all distros',
621 ... 'All you would want from a distro', 'zero', 'uberdistro.org',
622- ... mark, cprov)
623+ ... mark, cprov, cprov)
624
625 The primary archive for the Überdistro was created by the
626 IDistributionSet.new() method. Let's check its publish flag.
627
628=== modified file 'lib/lp/testing/factory.py'
629--- lib/lp/testing/factory.py 2011-03-11 12:34:18 +0000
630+++ lib/lp/testing/factory.py 2011-03-14 14:59:36 +0000
631@@ -2199,8 +2199,8 @@
632 return library_file_alias
633
634 def makeDistribution(self, name=None, displayname=None, owner=None,
635- members=None, title=None, aliases=None,
636- bug_supervisor=None):
637+ registrant=None, members=None, title=None,
638+ aliases=None, bug_supervisor=None):
639 """Make a new distribution."""
640 if name is None:
641 name = self.getUniqueString(prefix="distribution")
642@@ -2211,13 +2211,15 @@
643 description = self.getUniqueString()
644 summary = self.getUniqueString()
645 domainname = self.getUniqueString()
646+ if registrant is None:
647+ registrant = self.makePerson()
648 if owner is None:
649 owner = self.makePerson()
650 if members is None:
651 members = self.makeTeam(owner)
652 distro = getUtility(IDistributionSet).new(
653 name, displayname, title, description, summary, domainname,
654- members, owner)
655+ members, owner, registrant)
656 if aliases is not None:
657 removeSecurityProxy(distro).setAliases(aliases)
658 if bug_supervisor is not None:

Subscribers

People subscribed via source and target branches

to status/vote changes: