AddingLaunchpadCelebrity

Not logged in - Log In / Register

Revision 4 as of 2009-08-04 09:51:32

Clear message

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:

XXX: This example is wrong, since it will update the dev sampledata, not the testrunner sampledata. Please fix. -- JonathanLange <<Date(2009-08-04T09:51:32Z)>>

  $ 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.