4
There are many restrictions for setting the owner of a team.
10
The ObjectReassignmentView displays radio buttons that give you the
11
option to create a team as opposed to using an existing team. If the
12
user tries to create a new team with the same name as an existing team,
13
an error is displayed.
15
>>> from lp.registry.interfaces.person import IPersonSet
16
>>> person_set = getUtility(IPersonSet)
17
>>> operator = person_set.getByName('name12')
18
>>> login_person(operator)
19
>>> a_team = factory.makeTeam(
20
... owner=operator, name='a-team', displayname='A-Team')
21
>>> b_team = factory.makeTeam(
22
... owner=operator, name='b-team', displayname='B-Team')
23
>>> c_team = factory.makeTeam(
24
... owner=operator, name='c-team', displayname='C-Team')
25
>>> a_team.addMember(b_team, operator)
27
>>> b_team.addMember(c_team, operator)
29
>>> transaction.commit()
31
>>> view = create_initialized_view(
32
... c_team, '+reassign', principal=operator)
33
>>> print list(w.name for w in view.widgets)
34
['field.owner', 'field.existing']
37
... 'field.owner': 'a-team',
38
... 'field.existing': 'new',
39
... 'field.actions.change': 'Change',
41
>>> view = create_initialized_view(
42
... a_team, '+reassign', form=form, principal=operator)
44
[u"There's already a person/team with the name 'a-team' in Launchpad.
45
Please choose a different name or select the option to make that
46
person/team the new owner, if that's what you want."]
49
Cyclical Team Membership Error
50
------------------------------
52
When a person or team becomes the owner of another team, they are also
53
added as a member. Team memberships cannot be cyclical; therefore, the
54
team can't have its owner be a team of which it is a direct or indirect
58
... 'field.owner': 'b-team',
59
... 'field.existing': 'existing',
60
... 'field.actions.change': 'Change',
62
>>> view = create_initialized_view(
63
... c_team, '+reassign', form=form, principal=operator)
64
>>> print view.widget_errors
65
{'owner': u'Circular team memberships are not allowed.
66
B-Team cannot be the new team owner, since C-Team is a direct member
67
of B-Team. <...><...>'}
69
If there is an indirect membership between the teams, the path between
70
the teams is displayed so that the user has a better idea how to resolve
74
... 'field.owner': 'a-team',
75
... 'field.existing': 'existing',
76
... 'field.actions.change': 'Change',
78
>>> view = create_initialized_view(
79
... c_team, '+reassign', form=form, principal=operator)
80
>>> print view.widget_errors
81
{'owner': u'Circular team memberships are not allowed.
82
A-Team cannot be the new team owner, since C-Team is an
83
indirect member of A-Team. <...>(C-Team⇒B-Team⇒A-Team)<...>'}