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
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-06-13 11:02:30 +0000
+++ database/schema/security.cfg 2010-06-16 09:10:57 +0000
@@ -1056,7 +1056,7 @@
1056public.account = SELECT, INSERT1056public.account = SELECT, INSERT
1057public.accountpassword = SELECT, INSERT1057public.accountpassword = SELECT, INSERT
1058public.person = SELECT, INSERT, UPDATE1058public.person = SELECT, INSERT, UPDATE
1059public.emailaddress = SELECT, INSERT1059public.emailaddress = SELECT, INSERT, UPDATE
1060public.teamparticipation = SELECT, INSERT1060public.teamparticipation = SELECT, INSERT
1061public.teammembership = SELECT1061public.teammembership = SELECT
1062public.wikiname = SELECT, INSERT1062public.wikiname = SELECT, INSERT
10631063
=== modified file 'lib/lp/archiveuploader/tests/nascentuploadfile.txt'
--- lib/lp/archiveuploader/tests/nascentuploadfile.txt 2010-04-20 21:20:43 +0000
+++ lib/lp/archiveuploader/tests/nascentuploadfile.txt 2010-06-16 09:10:57 +0000
@@ -409,6 +409,37 @@
409 >>> addr['person'].creation_comment409 >>> addr['person'].creation_comment
410 u'when the some-source_6.6.6 package was uploaded to hoary/RELEASE'410 u'when the some-source_6.6.6 package was uploaded to hoary/RELEASE'
411411
412If the email address is registered but not associated with a person it will be
413associated with a new Person. This involves updating the email address, something
414for which the uploader must have explicit permissions (bug 589073).
415
416 >>> sig_file.policy.create_people
417 True
418
419 >>> from canonical.database.sqlbase import commit
420 >>> from canonical.launchpad.interfaces.account import IAccountSet
421 >>> from lp.registry.interfaces.person import (
422 ... PersonCreationRationale, IPersonSet)
423 >>> (acct, email) = getUtility(IAccountSet).createAccountAndEmail(
424 ... "foo@canonical.com", PersonCreationRationale.UNKNOWN,
425 ... "fo", "secr1t")
426 >>> person = getUtility(IPersonSet).createPersonWithoutEmail("fo",
427 ... rationale=PersonCreationRationale.UNKNOWN)
428 >>> person.account = acct
429
430 Commit the changes so the emailaddress will have to be updated later
431 rather than inserted.
432
433 >>> commit()
434
435 >>> addr = sig_file.parseAddress("Foo <foo@canonical.com>")
436 >>> print addr['person'].creation_rationale.name
437 UNKNOWN
438 >>> commit()
439
440 >>> print addr['email']
441 foo@canonical.com
442
412If the use an un-initialised policy to create a launchpad person the443If the use an un-initialised policy to create a launchpad person the
413creation_rationale will still be possible, however missing important444creation_rationale will still be possible, however missing important
414information, the upload target:445information, the upload target:
@@ -765,7 +796,7 @@
765 ... mock_logger_quiet)796 ... mock_logger_quiet)
766 >>> list(ed_binary_deb.verifyDebTimestamp())797 >>> list(ed_binary_deb.verifyDebTimestamp())
767 [UploadError('ed_0.2-20_i386.deb: has 26 file(s) with a time stamp too 798 [UploadError('ed_0.2-20_i386.deb: has 26 file(s) with a time stamp too
768 far into the future (e.g. control [Thu Jan 3 19:29:01 2008]).',)]799 far into the future (e.g. control [Thu Jan 3 19:29:01 2008]).',)]
769800
770... as well as for being too old:801... as well as for being too old:
771802

Subscribers

People subscribed via source and target branches

to status/vote changes: