Editing large teams fails because taking a snapshot of the team includes all of the
collections for that team, big stuff like all of the members. There is no reason for
those collections to be part of the snapshot.
== Proposed fix ==
lazr.lifecycle has a new method 'doNotSnapshot' that can encapuslate a Field and make
it not be included in the snapshot. On IPerson all of the collections have been
wrapped in that method to prevent their inclusion.
== Pre-implementation notes ==
Chats with Curtis.
== Implementation details ==
As above.
== Tests ==
I've added a test to show that the fields I currently expect to be omitted from the
snapshot are in fact omitted. It's not a very interesting test but there to prevent
regression.
bin/test -vvm lp.registry -t test_person_snapshot
== Demo and Q/A ==
On staging become an admin and try to edit the team in the bug report. It should
succeed.
= Launchpad lint =
Bah!
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
lib/canonical/launchpad/webapp/snapshot.py
11: [F0401] Unable to import 'lazr.lifecycle.interfaces' (No module named lifecycle)
lib/lp/registry/interfaces/person.py
52: [F0401] Unable to import 'lazr.enum' (No module named enum)
53: [F0401] Unable to import 'lazr.lifecycle.snapshot' (No module named lifecycle)
54: [F0401] Unable to import 'lazr.restful.interface' (No module named restful)
55: [F0401] Unable to import 'lazr.restful.declarations' (No module named restful)
62: [F0401] Unable to import 'lazr.restful.fields' (No module named restful)
406: [E1002, PersonNameField._validate] Use super on an old style class
1401: [C0322, IPersonEditRestricted.addMember] Operator not preceded by a space
status=copy_field(ITeamMembership['status']),
^
comment=Text(required=False))
@export_write_operation()
def addMember(person, reviewer, status=TeamMembershipStatus.APPROVED,
comment=None, force_team_add=False,
may_subscribe_to_list=True):
1433: [C0322, IPersonEditRestricted.acceptInvitationToBeMemberOf] Operator not
preceded by a space
comment=Text())
^
@export_write_operation()
def acceptInvitationToBeMemberOf(team, comment):
1445: [C0322, IPersonEditRestricted.declineInvitationToBeMemberOf] Operator not
preceded by a space
comment=Text())
^
@export_write_operation()
def declineInvitationToBeMemberOf(team, comment):
1737: [C0322, IPersonSet.newTeam] Operator not preceded by a space
defaultmembershipperiod='default_membership_period',
^
defaultrenewalperiod='default_renewal_period')
@operation_parameters(
subscriptionpolicy=Choice(
title=_('Subscription policy'), vocabulary=TeamSubscriptionPolicy,
required=False, default=TeamSubscriptionPolicy.MODERATED))
@export_factory_operation(
ITeam, ['name', 'displayname', 'teamdescription',
'defaultmembershipperiod', 'defaultrenewalperiod'])
def newTeam(teamowner, name, displayname, teamdescription=None,
subscriptionpolicy=TeamSubscriptionPolicy.MODERATED,
defaultmembershipperiod=None, defaultrenewalperiod=None):
lib/lp/registry/model/product.py
28: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
lib/lp/registry/tests/test_person.py
20: [F0401] Unable to import 'lazr.lifecycle.snapshot' (No module named lifecycle)
= Summary =
Editing large teams fails because taking a snapshot of the team includes all of the
collections for that team, big stuff like all of the members. There is no reason for
those collections to be part of the snapshot.
== Proposed fix ==
lazr.lifecycle has a new method 'doNotSnapshot' that can encapuslate a Field and make
it not be included in the snapshot. On IPerson all of the collections have been
wrapped in that method to prevent their inclusion.
== Pre-implementation notes ==
Chats with Curtis.
== Implementation details ==
As above.
== Tests ==
I've added a test to show that the fields I currently expect to be omitted from the
snapshot are in fact omitted. It's not a very interesting test but there to prevent
regression.
bin/test -vvm lp.registry -t test_person_ snapshot
== Demo and Q/A ==
On staging become an admin and try to edit the team in the bug report. It should
succeed.
= Launchpad lint =
Bah!
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: /launchpad/ webapp/ snapshot. py registry/ doc/person. txt registry/ interfaces/ person. py registry/ model/product. py registry/ tests/test_ person. py
lib/canonical
versions.cfg
lib/lp/
lib/lp/
lib/lp/
lib/lp/
== Pylint notices ==
lib/canonical/ launchpad/ webapp/ snapshot. py .interfaces' (No module named lifecycle)
11: [F0401] Unable to import 'lazr.lifecycle
lib/lp/ registry/ interfaces/ person. py .snapshot' (No module named lifecycle) interface' (No module named restful) declarations' (No module named restful) fields' (No module named restful) ._validate] Use super on an old style class ricted. addMember] Operator not preceded by a space copy_field( ITeamMembership ['status' ]), Text(required= False)) write_operation () TeamMembershipS tatus.APPROVED, add=False, subscribe_ to_list= True): ricted. acceptInvitatio nToBeMemberOf] Operator not write_operation () nToBeMemberOf( team, comment): ricted. declineInvitati onToBeMemberOf] Operator not write_operation () onToBeMemberOf( team, comment): ershipperiod= 'default_ membership_ period' , walperiod= 'default_ renewal_ period' ) parameters( npolicy= Choice( _('Subscription policy'), vocabulary= TeamSubscriptio nPolicy, TeamSubscriptio nPolicy. MODERATED) ) factory_ operation( bershipperiod' , 'defaultrenewal period' ]) =None, npolicy= TeamSubscriptio nPolicy. MODERATED, ershipperiod= None, defaultrenewalp eriod=None) :
52: [F0401] Unable to import 'lazr.enum' (No module named enum)
53: [F0401] Unable to import 'lazr.lifecycle
54: [F0401] Unable to import 'lazr.restful.
55: [F0401] Unable to import 'lazr.restful.
62: [F0401] Unable to import 'lazr.restful.
406: [E1002, PersonNameField
1401: [C0322, IPersonEditRest
status=
^
comment=
@export_
def addMember(person, reviewer, status=
comment=None, force_team_
may_
1433: [C0322, IPersonEditRest
preceded by a space
comment=Text())
^
@export_
def acceptInvitatio
1445: [C0322, IPersonEditRest
preceded by a space
comment=Text())
^
@export_
def declineInvitati
1737: [C0322, IPersonSet.newTeam] Operator not preceded by a space
defaultmemb
^
defaultrene
@operation_
subscriptio
title=
required=False, default=
@export_
ITeam, ['name', 'displayname', 'teamdescription',
'defaultmem
def newTeam(teamowner, name, displayname, teamdescription
subscriptio
defaultmemb
lib/lp/ registry/ model/product. py
28: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
lib/lp/ registry/ tests/test_ person. py .snapshot' (No module named lifecycle)
20: [F0401] Unable to import 'lazr.lifecycle