~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
= Wikinames =

Wikinames are associated with a person and must be created through the
IWikiNameSet utility.

    >>> from lp.registry.interfaces.person import IPersonSet
    >>> from lp.registry.interfaces.role import IHasOwner
    >>> from lp.registry.interfaces.wikiname import (
    ...     IWikiName, IWikiNameSet)

The new() method of IWikiNameSet takes the person who will be associated
with the Wikiname, the Wiki's base URL and the name of the person's page
on that wiki.

    >>> salgado = getUtility(IPersonSet).getByName('salgado')
    >>> wiki_name = getUtility(IWikiNameSet).new(
    ...     salgado, 'https://wiki.canonical.com/', 'Salgado')

The returned WikiName object provides both IWikiName and IHasOwner.

    >>> from lp.services.webapp.testing import verifyObject
    >>> verifyObject(IWikiName, wiki_name)
    True
    >>> verifyObject(IHasOwner, wiki_name)
    True

All wiki names of a person can be obtained, ordered alphabetically by wiki URL
and name, through IPerson.wiki_names.

    >>> for wiki in salgado.wiki_names:
    ...     print "%s%s" % (wiki.wiki, wiki.wikiname)
    https://wiki.canonical.com/Salgado
    https://wiki.ubuntu.com/GuilhermeSalgado