Diff for "AddingLaunchpadCelebrity"

Not logged in - Log In / Register

Differences between revisions 2 and 3
Revision 2 as of 2009-08-04 09:11:27
Size: 2117
Editor: jml
Comment:
Revision 3 as of 2009-08-04 09:11:49
Size: 2128
Editor: jml
Comment:
Deletions are marked like this. Additions are marked like this.
Line 30: Line 30:
  ... 'celebrity@launchpad.net', PersonCreationRationale.UNKNOWN, name='my-celebrity', displayname='My Celebrity', hide_email_addresses=True)   ... 'celebrity@launchpad.net', PersonCreationRationale.UNKNOWN, name='my-celebrity',
  ...
displayname='My Celebrity', hide_email_addresses=True)

Adding a new Launchpad Celebrity

Sometimes you need to define a new celebrity. A good example is when you add a script and you need a celebrity to own the content produced by that script.So here is the procedure to add a new LaunchpadCelebrities to ILaunchpadCelebrities.

  1. First step is to check if one of the existing celebrities can be used. If this is the case, use it and you're done!
  2. Before creating a new Person or Team, check if an existing one, either in sampledata or in production, can be used.
  3. You will need to add the Person or Team to sampledata. If the celebrity doesn't exist in production, you will also need to create a script to create it in production under database/schema/pending. Celebrity should have an email but no password.

  4. Add the celebrity name and description to canonical.launchpad.interfaces.launchpad.ILaunchpadCelebrities.

  5. Add a test for your celebrity to lib/canonical/launchpad/doc/celebrities.txt.

  6. Add the required CelebrityDescriptor to implement your celebrity to lib/canonical/launchpad/utilities/celebrities.py.

  7. If your celebrity doesn't exist in production: when your branch lands, don't forget to add a note to LaunchpadProductionStatus about the script that adds your celebrity to the database.

How to add a celebrity to sample data

The safest way to add the Person or Team to sampledata is by using the IPersonSet API:

  $ make schema
  $ make harness
  >>> celebrity, celebrity_email = getUtility(IPersonSet).createPersonAndEmail(
  ...    'celebrity@launchpad.net', PersonCreationRationale.UNKNOWN, name='my-celebrity', 
  ...    displayname='My Celebrity', hide_email_addresses=True)
  >>> celebrity.validateAndEnsurePreferredEmail(celebrity_email)
  >>> transaction.commit()
  $ make newsampledata

If you need to create a patch for production, examine the diff between the old sample data and the new. You'll need to determine the ID of the rows at run time using subselect though. An alternative is to use a python script similar to the above.

AddingLaunchpadCelebrity (last edited 2009-08-04 16:43:52 by jml)