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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
=====================
Team membership views
=====================
Breadcrumbs
-----------
Team membership breadcrumbs uses the member's displayname to create
"<displayname>'s membership".
>>> from lp.testing.menu import make_fake_request
>>> from lp.registry.interfaces.teammembership import ITeamMembershipSet
>>> team_owner = factory.makePerson(name='team-owner')
>>> super_team = factory.makeTeam(name='us', owner=team_owner)
>>> membership_set = getUtility(ITeamMembershipSet)
>>> membership = membership_set.getByPersonAndTeam(
... team_owner, super_team)
>>> view = create_view(membership, '+index')
>>> request = make_fake_request(
... 'http://launchpad.dev/~us/+member/team-owner',
... [super_team, membership, view])
>>> hierarchy = create_initialized_view(
... membership, '+hierarchy', request=request)
>>> hierarchy.items
[<TeamBreadcrumb ... text='\u201cUs\u201d team'>,
<TeamMembershipBreadcrumb ... text='Team-owner's membership'>]
+member view
------------
The TeamMembershipEditView provides a label that described the membership
state of the IPerson.
>>> view = create_view(membership, '+index')
>>> print view.label
Active member Team-owner
+invitations view
-----------------
When a team is invited to join another team, the TeamInvitationsView controls
the ~team/+invitations page.
>>> team = factory.makeTeam(displayname='Bassists', name='bassists')
>>> view = create_initialized_view(team, '+invitations')
>>> print view.label
Invitations for Bassists
+invitation/<team> view
-----------------------
The TeamInvitationView allows a team admin to accept or decline an invitation
to join another team. The invitation is a TeamMembership instance. The view
is applied during the stepto traversal--it is not a named view in ZCML.
>>> from lp.registry.browser.team import TeamInvitationView
>>> login_person(team_owner)
>>> ignored = super_team.addMember(team, team_owner)
>>> membership = membership_set.getByPersonAndTeam(team, super_team)
>>> login_person(team.teamowner)
>>> view = TeamInvitationView(membership, request)
>>> print view.label
Make Bassists a member of Us
The view provides page_title to create a breadcrumb that describes this
use the TeamMembership.
>>> print view.page_title.encode('ascii', 'backslashreplace')
\u201cUs\u201d team invitation
|