~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/testing/factory.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-14 00:03:36 UTC
  • mfrom: (14494.2.3 private-traversal-2)
  • Revision ID: launchpad@pqm.canonical.com-20111214000336-xrnjofa8o4koipmm
[rs=sinzui][no-qa] restore the test and webapp changes that remove
        the assumptions that any attribute can be access on an IPerson.

Show diffs side-by-side

added added

removed removed

Lines of Context:
772
772
            address, person, email_status, account)
773
773
 
774
774
    def makeTeam(self, owner=None, displayname=None, email=None, name=None,
775
 
                 description=None,
 
775
                 description=None, icon=None, logo=None,
776
776
                 subscription_policy=TeamSubscriptionPolicy.OPEN,
777
777
                 visibility=None, members=None):
778
778
        """Create and return a new, arbitrary Team.
783
783
        :param displayname: The team's display name.  If not given we'll use
784
784
            the auto-generated name.
785
785
        :param description: Team team's description.
786
 
        :type string:
 
786
        :type description string:
787
787
        :param email: The email address to use as the team's contact address.
788
788
        :type email: string
 
789
        :param icon: The team's icon.
 
790
        :param logo: The team's logo.
789
791
        :param subscription_policy: The subscription policy of the team.
790
792
        :type subscription_policy: `TeamSubscriptionPolicy`
791
793
        :param visibility: The team's visibility. If it's None, the default
810
812
        team = getUtility(IPersonSet).newTeam(
811
813
            owner, name, displayname, teamdescription=description,
812
814
            subscriptionpolicy=subscription_policy)
 
815
        naked_team = removeSecurityProxy(team)
813
816
        if visibility is not None:
814
817
            # Visibility is normally restricted to launchpad.Commercial, so
815
818
            # removing the security proxy as we don't care here.
816
 
            removeSecurityProxy(team).visibility = visibility
 
819
            naked_team.visibility = visibility
817
820
        if email is not None:
818
821
            team.setContactAddress(
819
822
                getUtility(IEmailAddressSet).new(email, team))
 
823
        if icon is not None:
 
824
            naked_team.icon = icon
 
825
        if logo is not None:
 
826
            naked_team.logo = logo
820
827
        if members is not None:
821
 
            naked_team = removeSecurityProxy(team)
822
828
            for member in members:
823
829
                naked_team.addMember(member, owner)
824
830
        return team
1124
1130
 
1125
1131
        if registrant is None:
1126
1132
            if owner.is_team:
1127
 
                registrant = owner.teamowner
 
1133
                registrant = removeSecurityProxy(owner).teamowner
1128
1134
            else:
1129
1135
                registrant = owner
1130
1136