Merge lp:~jelmer/launchpad/bug589073 into lp:launchpad/db-devel

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 9479
Proposed branch: lp:~jelmer/launchpad/bug589073
Merge into: lp:launchpad/db-devel
Diff against target: 62 lines (+33/-2)
2 files modified
database/schema/security.cfg (+1/-1)
lib/lp/archiveuploader/tests/nascentuploadfile.txt (+32/-1)
To merge this branch: bzr merge lp:~jelmer/launchpad/bug589073
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) code Approve
Review via email: mp+27683@code.launchpad.net

Commit message

Allow archiveuploader to update the emailaddress table.

Description of the change

In rare occassions it may be necessary for the uploader to update an existing emailaddress entry to link it to a person. This is what happened in bug 589073.

This branch gives the archive uploader the permission to update emailaddress entries and updates nascentfileupload.txt to reproduce this situation.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Looks good. Just one note: you'll usually want to use

    >>> print value
    foo

rather than...

    >>> print value
    'foo'

...which can break unnecessarily if the value comes out as u'foo' etc.

review: Approve (code)
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I assume you mean without the "print" on the first line, I've fixed my branch accordingly.

Thanks for the review.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/security.cfg'
2--- database/schema/security.cfg 2010-06-13 11:02:30 +0000
3+++ database/schema/security.cfg 2010-06-16 09:10:57 +0000
4@@ -1056,7 +1056,7 @@
5 public.account = SELECT, INSERT
6 public.accountpassword = SELECT, INSERT
7 public.person = SELECT, INSERT, UPDATE
8-public.emailaddress = SELECT, INSERT
9+public.emailaddress = SELECT, INSERT, UPDATE
10 public.teamparticipation = SELECT, INSERT
11 public.teammembership = SELECT
12 public.wikiname = SELECT, INSERT
13
14=== modified file 'lib/lp/archiveuploader/tests/nascentuploadfile.txt'
15--- lib/lp/archiveuploader/tests/nascentuploadfile.txt 2010-04-20 21:20:43 +0000
16+++ lib/lp/archiveuploader/tests/nascentuploadfile.txt 2010-06-16 09:10:57 +0000
17@@ -409,6 +409,37 @@
18 >>> addr['person'].creation_comment
19 u'when the some-source_6.6.6 package was uploaded to hoary/RELEASE'
20
21+If the email address is registered but not associated with a person it will be
22+associated with a new Person. This involves updating the email address, something
23+for which the uploader must have explicit permissions (bug 589073).
24+
25+ >>> sig_file.policy.create_people
26+ True
27+
28+ >>> from canonical.database.sqlbase import commit
29+ >>> from canonical.launchpad.interfaces.account import IAccountSet
30+ >>> from lp.registry.interfaces.person import (
31+ ... PersonCreationRationale, IPersonSet)
32+ >>> (acct, email) = getUtility(IAccountSet).createAccountAndEmail(
33+ ... "foo@canonical.com", PersonCreationRationale.UNKNOWN,
34+ ... "fo", "secr1t")
35+ >>> person = getUtility(IPersonSet).createPersonWithoutEmail("fo",
36+ ... rationale=PersonCreationRationale.UNKNOWN)
37+ >>> person.account = acct
38+
39+ Commit the changes so the emailaddress will have to be updated later
40+ rather than inserted.
41+
42+ >>> commit()
43+
44+ >>> addr = sig_file.parseAddress("Foo <foo@canonical.com>")
45+ >>> print addr['person'].creation_rationale.name
46+ UNKNOWN
47+ >>> commit()
48+
49+ >>> print addr['email']
50+ foo@canonical.com
51+
52 If the use an un-initialised policy to create a launchpad person the
53 creation_rationale will still be possible, however missing important
54 information, the upload target:
55@@ -765,7 +796,7 @@
56 ... mock_logger_quiet)
57 >>> list(ed_binary_deb.verifyDebTimestamp())
58 [UploadError('ed_0.2-20_i386.deb: has 26 file(s) with a time stamp too
59- far into the future (e.g. control [Thu Jan 3 19:29:01 2008]).',)]
60+ far into the future (e.g. control [Thu Jan 3 19:29:01 2008]).',)]
61
62 ... as well as for being too old:
63

Subscribers

People subscribed via source and target branches

to status/vote changes: